[minigraph] generate device under test minigraph file#207
[minigraph] generate device under test minigraph file#207maggiemsft merged 4 commits intosonic-net:masterfrom
Conversation
|
@maggiemsft, |
|
|
||
| - block: | ||
| - name: saved original minigraph file (if original file may don't exist, then ignore errors) | ||
| shell: mv /etc/sonic/minigraph.xml /etc/sonic/minigraph.xml.ori |
There was a problem hiding this comment.
ori [](start = 68, length = 3)
-> orig
There was a problem hiding this comment.
Probably you're fixed another line. This is still 'ori'
| # Template files for generating minigraph.xml are defined in template/topo directory | ||
| # | ||
| # To generate and deploy minigraph for SONiC switch matching the VM topology please use following command | ||
| # ANSIBLE_SCP_IF_SSH=y ansible-playbook -i lab config_sonic_basedon_testbed.yml --vault-password-file=~/.password -l sonic_dut_name -e VM_base=VM0300 -e topo=t0 [-e deploy=true] |
There was a problem hiding this comment.
you can delete "ANSIBLE_SCP_IF_SSH=y" from here. It is not necessary.
| # | ||
| # Parameters | ||
| # -l str-msn2700-01 - the sonic_dut_name you are going to generate minigraph for | ||
| # -e VM_base=VM0300 - the VM name which is used to as base to calculate VM name for this set |
There was a problem hiding this comment.
vm_base, not VM_base
| # Parameters | ||
| # -l str-msn2700-01 - the sonic_dut_name you are going to generate minigraph for | ||
| # -e VM_base=VM0300 - the VM name which is used to as base to calculate VM name for this set | ||
| # -e topo=t0 - the name of removed topo |
There was a problem hiding this comment.
Please remove "removed" from here
| gather_facts: yes | ||
| tasks: | ||
| - fail: msg="need to provide topology type and vm base like topo=t0 and vm_base=VM100" | ||
| when: topo and vm_base is not defined |
There was a problem hiding this comment.
I think you need to check topo and vm_base in separate
I'd write it as
(topo is not defined) and (vm_base is not defined)
| when: topo and vm_base is not defined | ||
|
|
||
| - fail: msg="need hwsku, interface speed, netmask and interface prefix/postfix defined to generate configuration file" | ||
| when: hwsku and iface_speed and mgmt_subnet_mask_length and iface_prefix and iface_postfix is not defined |
There was a problem hiding this comment.
the same as previous comment
ansible/library/testbed_vm_info.py
Outdated
| eos = {} | ||
| with open(self.topofile) as f: | ||
| vm_topology = yaml.load(f) | ||
| f.close() |
There was a problem hiding this comment.
'with' keyword will close the 'f' file descriptor for you. so it's better to remove f.close() from here
ansible/library/testbed_vm_info.py
Outdated
| def gather_veos_vm(self, eos_name, vm_index): | ||
| vmname = 'VM'+format(vm_index, '04d') | ||
| vmcmd = 'cat '+VM_INV_FILE+' | grep '+ vmname | ||
| p = subprocess.Popen(vmcmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
There was a problem hiding this comment.
probably it's more clean to open the inventory file as a text file and parse it with python?
pavel-shirshov
left a comment
There was a problem hiding this comment.
Please address comments I left.
| # Template files for generating minigraph.xml are defined in template/topo directory | ||
| # | ||
| # To generate and deploy minigraph for SONiC switch matching the VM topology please use following command | ||
| # ansible-playbook -i lab config_sonic_basedon_testbed.yml --vault-password-file=~/.password -l sonic_dut_name -e VM_base=VM0300 -e topo=t0 [-e deploy=true] |
|
|
||
| - block: | ||
| - name: saved original minigraph file (if original file may don't exist, then ignore errors) | ||
| shell: mv /etc/sonic/minigraph.xml /etc/sonic/minigraph.xml.ori |
There was a problem hiding this comment.
Probably you're fixed another line. This is still 'ori'
| dns_servers: ['10.0.0.5', '10.0.0.6'] | ||
|
|
||
| # forced_mgmt_routes | ||
| forced_mgmt_routes: ['10.0.0.100/31', '10.250.0.8', '10.255.0.0/28'] |
There was a problem hiding this comment.
I'm not sure here: It should be '10.250.0.8' (without prefix), or '10.250.0.8/32'
There was a problem hiding this comment.
Checked with current graph format, no /32
ansible/lab
Outdated
| [sonic_mlnx_40:vars] | ||
| hwsku="ACS-MSN2700" | ||
| iface_prefix="Ethernet" | ||
| iface_postfix="" |
| {% endif %} | ||
| <Prefix>FC00::{{ ('%0x' % (64+index*4 +1)) | upper }}/126</Prefix> | ||
| </IPInterface> | ||
| {% endfor %} |
There was a problem hiding this comment.
this is very difficult to maintain. it is better to use thi file to generate the interface name. https://github.com/Azure/sonic-buildimage/blob/master/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini
In buildimage repo, it builds a debian package named sonic-device-data package. you can install the package in the sonic-mgmt docker and get the actual interface name based on port_config.ini for each hwsku.
| <StartRouter>{{ inventory_hostname }}</StartRouter> | ||
| <StartPeer>FC00::{{ ('%0x' % (113 + index*4 )) | upper }}</StartPeer> | ||
| <EndRouter>ARISTA0{{ index+1 }}T1</EndRouter> | ||
| <EndPeer>FC00::{{ ('%0x' % (113 + index*4 +1)) | upper }}</EndPeer> |
There was a problem hiding this comment.
please be consistent on the whitespace usage
ansible/lab
Outdated
| [sonic_mlnx_40:vars] | ||
| hwsku="ACS-MSN2700" | ||
| iface_prefix="Ethernet" | ||
| iface_postfix="" |
There was a problem hiding this comment.
remove iface_prefix and postfix, use port_config.ini in the buildimge repo to convert.
| become: true | ||
| template: src=templates/topo/{{ template_name }}.j2 | ||
| dest=/etc/sonic/minigraph.xml | ||
|
|
There was a problem hiding this comment.
need to disable /etc/sonic/updategraph.conf to avoid downloading url from dhcp
ansible/library/testbed_vm_info.py
Outdated
| vms = {} | ||
| with open(VM_INV_FILE) as f: | ||
| lines = f.readlines() | ||
| for line in lines: |
|
👎 |
lguohan
left a comment
There was a problem hiding this comment.
use port_config.ini to get the actual port name
| register: p | ||
| connection: local | ||
|
|
||
| #### TODO: build the package into sonic-mgmt docker and remove this block of code #### |
There was a problem hiding this comment.
sonic-device-data is in sonic-mgmt docker now. you can remove this block of code now.
| - fail: msg="need hwsku, interface speed, netmask and interface prefix/postfix defined to generate configuration file" | ||
| when: (hwsku is not defined) or (iface_speed is not defined) or (mgmt_subnet_mask_length is not defined) | ||
|
|
||
| - stat: |
There was a problem hiding this comment.
you can assume /usr/share/sonic/device is there in the container.
| file: path=/tmp/buildimage state=absent | ||
| when: p.stat.isdir is not defined | ||
| connection: local | ||
| when: p.stat.isdir is not defined |
There was a problem hiding this comment.
remove this block as well.
ansible/library/port_alias.py
Outdated
| return | ||
| else: | ||
| self.portmap['alias'] = True | ||
| self.portmap['mapping'][mapping[0]] = mapping[2] |
There was a problem hiding this comment.
the portmap is index -> alias map. index is the row index in the port_config.ini. let's have the assumption that the ports in port_config.ini are from index 0 to maximum.
then if there is alias, the port_alias[index] = alias, else port_alias[index] = name.
ansible/library/port_alias.py
Outdated
| FILE_PATH = '/usr/share/sonic/device' | ||
| PORTMAP_FILE = 'port_config.ini' | ||
|
|
||
| class SonicPortmap(): |
ansible/library/port_alias.py
Outdated
| if 'Ethernet' in line: | ||
| mapping = line.split() | ||
| if len(mapping) < 3: | ||
| self.portmap['alias'] = False |
There was a problem hiding this comment.
this line is not used, remove.
| <EnableFlowControl>true</EnableFlowControl> | ||
| <Index>1</Index> | ||
| {% if port_alias['alias'] %} | ||
| <InterfaceName>{{ port_alias['mapping'][sonic_if_name] }}</InterfaceName> |
There was a problem hiding this comment.
port_alias['mapping'][sonic_if_name] -> port_alias[index]
i do not think you really need to first construct sonic_if_name, just use the index (0~31) for 32 port minigraph. you can assume the portname is ordered by the index in the port_config.ini
| - name: save original updategraph configuration (if original file may don't exist, then ignore errors) | ||
| shell: mv /etc/sonic/updategraph.conf /etc/sonic/updategrph.conf.orig | ||
| become: true | ||
| ignore_errors: true |
There was a problem hiding this comment.
use lineinfile module to replace the enable=true line to enable=false line.
| dest=/etc/sonic/minigraph.xml | ||
| become: true | ||
|
|
||
| - name: disable automatic minigraph update if we are deploying new minigraph into SONiC |
* generate match SONiC minigraph based on testbed name and type defined in testbed.csv * fixes based on feedback * using port_config to get interface name and alias and fixes based on feedback * use index to find the port name or alias
…ut multi-asic (sonic-net#207) <!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> Summary: Fixes # (issue) - Split the original PR sonic-net#17130 into individual PRs for each test. - This is an enhancement to support VOQ Single DUT Multi-ASIC setup for T2 topo. ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [x] Test case improvement ### Back port request - [ ] 202012 - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [x] 202411 ### Approach #### What is the motivation for this PR? - New testbed modification of VOQ Single DUT and multi-asic. #### How did you do it? - Skip internal neighbors for both VOQ single dut multi-asic as well as multi-dut multi-asic. #### How did you verify/test it? #### Any platform specific information? #### Supported testbed topology if it's a new test case? - T2 VOQ Single Dut Multi ASIC ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
…onic-net#7647) Includes below commits ``` sonic-swss 05f0438 2021-05-19 | Fix build error (sonic-net#1751) [Shi Su] 1682a8d 2021-05-12 | [Bulk mode] Improve log in bulk failures (sonic-net#1740) [Shi Su] 4509e88 2021-04-27 | [routeorch] Add support for blackhole routes (sonic-net#1723) [Shi Su] 642014d 2019-10-31 | [fix] Use the same storm detection condition for queue occupancy non-zero case as the zero case (sonic-net#1111) [Wenda Ni] sonic-utilities 97fc442 2021-05-10 | [config]: Use mod_entry when editing VLAN_INTERFACE (sonic-net#1602) [Lawrence Lee] f60d579 2021-04-15 | [techsupport] Update show ip interface command (sonic-net#1562) [Mahesh Maddikayala] 821d29d 2021-04-14 | Fix Multi-ASIC show specific resursive route by using common parsing function (sonic-net#1560) [gechiang] sonic-linux-kernel 61b331f 2021-05-06 | [dps200] Add dps200 PSU module driver (sonic-net#207) [schobtr] sonic-platform-daemons 5d2960f 2021-05-17 | [xcvrd] add support for logging mux_metrics events into state DB (sonic-net#185) [vdahiya12] a5c9207 2021-05-11 | [thermalctld] Enable stopping thermal manager (sonic-net#180) [Junchao-Mellanox] 9123f63 2021-05-10 | [muxcable] Remove Xcvrd Sleep (sonic-net#174) [Tamer Ahmed] ```
sonic-net#14862) #### Why I did it src/linkmgrd ``` * 35f7d1c - (HEAD -> 202012, origin/202012) [202012][active-standby][bsl] fix no mux probe issue sonic-net#201 (sonic-net#206) (2 weeks ago) [Jing Zhang] * be701fb - [202012] pick codeql fixes (sonic-net#207) (2 weeks ago) [Jing Zhang] * 0b42cec - Enable debug symbols (sonic-net#199) (3 weeks ago) [Longxiang Lyu] ```
Minigraph is generated based on topology name and type defined testbed.csv
Currently it only covers t0, t1 and t1-lag for 32 ports SONiC devices
Will work on 64 ports later.