-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
…band, iBGP-peers (#3245) 1. Support chassis, multi-duts scenarios in TestbedProcessing. When testbed.yaml file contains card_type=Linecard or card_type=supervisor, TestbedProcessing will add that to lab, veos inventory files. When dut is multi-dut, TestbedProcessing will convert the dut type list to string. makeMain needs to publish supported_vm_types=[...] into main.yml 2. Support fabric_info generation in fabric_info.py when the num_asic > 0 and card_type is supervisor. 3. Use the fabric_info in minigraph templates to generated the fabric asic info. Also added SubRole=fabric, switch_type=fabric in DeviceMetadata for each fabric asic 4. Use variable name card_type instead of type in ansible, dut_utils.py and minigraph templates to be more explicit 5. allow t2 as a topo in testbed.py Linecard gen-minigraph related changes: 1. support adding inband data in LC's minigraph. VoqInbandInterfaces fields come from testbed.yaml (fields voq_inband_intf, voq_inband_type, voq_inband_ip) to lab/veos inventory files to minigraph. Data flows from testbed.yaml (fields voq_inband_intf, voq_inband_type, voq_inband_ip) to lab/veos inventory files to minigraph. 2. System ports Data flows from a. port_config.ini (new fileds required are: numVoq, coreId, corePortId), (existing fields: name, speed) b. switchId = running asic_id count across all linecards in the chassis c. systemPortId = running systemport count across all linecards in the chassis Each dut adds its own system-ports to its own ansible_facts. config_sonic_basedon_testbed.yml loops through all duts system-ports to create all_sysports d. added changes to port_alias to generate system ports for Recirc ports as well e. hostname comes from config_sonic_basedon_testbed.yml, asicname created in port_alias from asic_id when looping through num_asics 3. DeviceProperty <a:DeviceProperty> <a:Name>SwitchType</a:Name> <a:Reference i:nil="true"/> <a:Value>voq</a:Value> </a:DeviceProperty> <a:DeviceProperty> <a:Name>MaxCores</a:Name> <a:Reference i:nil="true"/> <a:Value>16</a:Value> </a:DeviceProperty> <a:DeviceProperty> <a:Name>SwitchId</a:Name> <a:Reference i:nil="true"/> <a:Value>0</a:Value> </a:DeviceProperty> a. switch type, maxcores are directly from testbed.yaml to inventory files to minigraph b. start_switchid is calculated for each linecard and set into inventory files from TestbedProcessing.py based on num_asics from previous linecards 4. iBGP peers iBGP sessions are setup between inband-ipaddress on all linecards a. take all voq_inband_ip to form a list all_inbands in ansible/config_sonic_basedon_testbed.yml b. minigraph_cpg iterates through all_inbands and configures a BGPSession, BGPPeer between the voq_inband_ip and all other addresses in all_inbands
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env python | ||
|
||
import ipaddress | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
saravanansv
Author
Contributor
|
||
DOCUMENTATION = ''' | ||
module: fabric_info.py | ||
short_description: Find SONiC Fabric ASIC inforamtion if applicable for the DUT | ||
Description: | ||
When the testbed has Fabric ASICs, this module helps to collect that information | ||
which helps in generating the minigraph | ||
Input: | ||
num_fabric_asic asics_host_basepfx asics_host_basepfx6 | ||
Return Ansible_facts: | ||
fabric_info: SONiC Fabric ASIC information | ||
''' | ||
|
||
EXAMPLES = ''' | ||
- name: get Fabric ASIC info | ||
fabric_info: num_fabric_asic=1 asics_host_basepfx="10.1.0.1/32" asics_host_basepfx="FC00:1::1/128" | ||
''' | ||
|
||
RETURN = ''' | ||
ansible_facts{ | ||
fabric_info: [{'asicname': 'ASIC0', 'ip_prefix': '10.1.0.1/32', 'ip6_prefix': 'FC00:1::1/128'}, | ||
{'asicname': 'ASIC1', 'ip_prefix': '10.1.0.2/32', 'ip6_prefix': 'FC00:1::2/128'}] | ||
} | ||
''' | ||
|
||
def main(): | ||
module = AnsibleModule( | ||
argument_spec=dict( | ||
num_fabric_asic=dict(type='str', required=True), | ||
asics_host_basepfx=dict(type='str', required=False), | ||
asics_host_basepfx6=dict(type='str', required=False) | ||
), | ||
supports_check_mode=True | ||
) | ||
m_args = module.params | ||
try: | ||
fabric_info = [] | ||
# num_fabric_asic may not be present for fixed systems which have no Fabric ASIC. | ||
# Then return empty fabric_info | ||
if 'num_fabric_asic' not in m_args or int(m_args['num_fabric_asic']) < 1: | ||
module.exit_json(ansible_facts={'fabric_info': fabric_info}) | ||
return | ||
num_fabric_asic = int( m_args[ 'num_fabric_asic' ] ) | ||
v4pfx = str( m_args[ 'asics_host_basepfx' ] ).split("/") | ||
v6pfx = str( m_args[ 'asics_host_basepfx6' ] ).split("/") | ||
v4base = int( ipaddress.IPv4Address(v4pfx[0]) ) | ||
v6base = int( ipaddress.IPv6Address(v6pfx[0]) ) | ||
for asic_id in range(num_fabric_asic): | ||
key = "ASIC%d" % asic_id | ||
next_v4addr = str( ipaddress.IPv4Address(v4base + asic_id) ) | ||
next_v6addr = str( ipaddress.IPv6Address(v6base + asic_id) ) | ||
data = { 'asicname': key, | ||
'ip_prefix': next_v4addr + "/" + v4pfx[-1], | ||
'ip6_prefix': next_v6addr + "/" + v6pfx[-1] } | ||
fabric_info.append( data ) | ||
module.exit_json(ansible_facts={'fabric_info': fabric_info}) | ||
except (IOError, OSError), e: | ||
fail_msg = "IO error" + str(e) | ||
module.fail_json(msg=fail_msg) | ||
except Exception, e: | ||
fail_msg = "failed to find the correct fabric asic info " + str(e) | ||
module.fail_json(msg=fail_msg) | ||
|
||
from ansible.module_utils.basic import * | ||
if __name__ == "__main__": | ||
main() |
@saravanansv why we need this ? Can you please clarify this.