[DPB]Removing default admin status initialization in DPB flow while loading minigraph (#8711)

To Fix #8697 . The config load_minigraph initializes 'admin_status' to up when platform.json has DPB configs. This doesn't happen when using port_config.ini
The update minigraph has logic to initialize only the ports whose neighbors are defined or those belonging to portchannel
However, a change was introduced to have default admin status to be 'up' in portconfig.py when the minigraph was using platform.json

This will lead to sanity check failure in sonic-mgmt and thus no test cases could be run
This commit is contained in:
Sudharsan Dhamal Gopalarathnam 2021-09-13 09:01:29 -07:00 committed by Judy Joseph
parent e3cfc44354
commit d8841cb876
5 changed files with 133 additions and 119 deletions

View File

@ -2,14 +2,12 @@
"Ethernet0_2x50G": {
"Ethernet2": {
"alias": "fortyGigE0/2",
"admin_status": "up",
"lanes": "27,28",
"speed": "50000",
"index": "0"
},
"Ethernet0": {
"alias": "fortyGigE0/0",
"admin_status": "up",
"lanes": "25,26",
"speed": "50000",
"index": "0"
@ -18,21 +16,18 @@
"Ethernet12_1x50G_2x25G": {
"Ethernet12": {
"alias": "fortyGigE0/12",
"admin_status": "up",
"lanes": "37,38",
"speed": "50000",
"index": "3"
},
"Ethernet14": {
"alias": "fortyGigE0/14",
"admin_status": "up",
"lanes": "39",
"speed": "25000",
"index": "3"
},
"Ethernet15": {
"alias": "fortyGigE0/15",
"admin_status": "up",
"lanes": "40",
"speed": "25000",
"index": "3"
@ -41,14 +36,12 @@
"Ethernet0_2x50G": {
"Ethernet2": {
"alias": "fortyGigE0/2",
"admin_status": "up",
"lanes": "27,28",
"speed": "50000",
"index": "0"
},
"Ethernet0": {
"alias": "fortyGigE0/0",
"admin_status": "up",
"lanes": "25,26",
"speed": "50000",
"index": "0"
@ -57,7 +50,6 @@
"Ethernet0_1x100G": {
"Ethernet0": {
"alias": "fortyGigE0/0",
"admin_status": "up",
"lanes": "25,26,27,28",
"speed": "100000",
"index": "0"
@ -66,28 +58,24 @@
"Ethernet0_4x25G": {
"Ethernet2": {
"alias": "fortyGigE0/2",
"admin_status": "up",
"lanes": "27",
"speed": "25000",
"index": "0"
},
"Ethernet3": {
"alias": "fortyGigE0/3",
"admin_status": "up",
"lanes": "28",
"speed": "25000",
"index": "0"
},
"Ethernet0": {
"alias": "fortyGigE0/0",
"admin_status": "up",
"lanes": "25",
"speed": "25000",
"index": "0"
},
"Ethernet1": {
"alias": "fortyGigE0/1",
"admin_status": "up",
"lanes": "26",
"speed": "25000",
"index": "0"
@ -96,21 +84,18 @@
"Ethernet0_2x25G_1x50G": {
"Ethernet2": {
"alias": "fortyGigE0/2",
"admin_status": "up",
"lanes": "27,28",
"speed": "50000",
"index": "0"
},
"Ethernet0": {
"alias": "fortyGigE0/0",
"admin_status": "up",
"lanes": "25",
"speed": "25000",
"index": "0"
},
"Ethernet1": {
"alias": "fortyGigE0/1",
"admin_status": "up",
"lanes": "26",
"speed": "25000",
"index": "0"
@ -119,21 +104,18 @@
"Ethernet0_1x50G_2x25G": {
"Ethernet2": {
"alias": "fortyGigE0/2",
"admin_status": "up",
"lanes": "27",
"speed": "25000",
"index": "0"
},
"Ethernet3": {
"alias": "fortyGigE0/3",
"admin_status": "up",
"lanes": "28",
"speed": "25000",
"index": "0"
},
"Ethernet0": {
"alias": "fortyGigE0/0",
"admin_status": "up",
"lanes": "25,26",
"speed": "50000",
"index": "0"
@ -142,28 +124,24 @@
"Ethernet4_4x25G": {
"Ethernet6": {
"alias": "fortyGigE0/6",
"admin_status": "up",
"lanes": "31",
"speed": "25000",
"index": "1"
},
"Ethernet7": {
"alias": "fortyGigE0/7",
"admin_status": "up",
"lanes": "32",
"speed": "25000",
"index": "1"
},
"Ethernet4": {
"alias": "fortyGigE0/4",
"admin_status": "up",
"lanes": "29",
"speed": "25000",
"index": "1"
},
"Ethernet5": {
"alias": "fortyGigE0/5",
"admin_status": "up",
"lanes": "30",
"speed": "25000",
"index": "1"
@ -172,14 +150,12 @@
"Ethernet4_2x50G": {
"Ethernet6": {
"alias": "fortyGigE0/6",
"admin_status": "up",
"lanes": "31,32",
"speed": "50000",
"index": "1"
},
"Ethernet4": {
"alias": "fortyGigE0/4",
"admin_status": "up",
"lanes": "29,30",
"speed": "50000",
"index": "1"
@ -188,14 +164,12 @@
"Ethernet8_2x50G": {
"Ethernet8": {
"alias": "fortyGigE0/8",
"admin_status": "up",
"lanes": "33,34",
"speed": "50000",
"index": "2"
},
"Ethernet10": {
"alias": "fortyGigE0/10",
"admin_status": "up",
"lanes": "35,36",
"speed": "50000",
"index": "2"
@ -204,14 +178,12 @@
"Ethernet8_1x50G_2x25G": {
"Ethernet10": {
"alias": "fortyGigE0/10",
"admin_status": "up",
"lanes": "35",
"speed": "25000",
"index": "2"
},
"Ethernet11": {
"alias": "fortyGigE0/11",
"admin_status": "up",
"lanes": "36",
"speed": "25000",
"index": "2"
@ -220,21 +192,18 @@
"Ethernet8_2x25G_1x50G": {
"Ethernet8": {
"alias": "fortyGigE0/8",
"admin_status": "up",
"lanes": "33",
"speed": "25000",
"index": "2"
},
"Ethernet9": {
"alias": "fortyGigE0/9",
"admin_status": "up",
"lanes": "34",
"speed": "25000",
"index": "2"
},
"Ethernet10": {
"alias": "fortyGigE0/10",
"admin_status": "up",
"lanes": "35,36",
"speed": "50000",
"index": "2"
@ -243,7 +212,6 @@
"Ethernet8_1x100G": {
"Ethernet8": {
"alias": "fortyGigE0/8",
"admin_status": "up",
"lanes": "33,34,35,36",
"speed": "100000",
"index": "2"

View File

@ -205,7 +205,6 @@ def gen_port_config(ports, parent_intf_id, index, alias_list, lanes, k, offset)
raise Exception('Regex return for speed is None...')
ports[intf_name]['index'] = index.split(",")[alias_position]
ports[intf_name]['admin_status'] = "up"
parent_intf_id += step
alias_position += 1

View File

@ -0,0 +1,118 @@
<DeviceMiniGraph xmlns="Microsoft.Search.Autopilot.Evolution" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<CpgDec/>
<DpgDec>
<DeviceDataPlaneInfo>
<IPSecTunnels/>
<LoopbackIPInterfaces/>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
<ManagementVIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>switch-t0</Hostname>
<PortChannelInterfaces>
<PortChannel>
<Name>PortChannel01</Name>
<AttachTo>Ethernet20</AttachTo>
<SubInterface/>
</PortChannel>
<PortChannel>
<Name>PortChannel1001</Name>
<AttachTo>Ethernet4;Ethernet6</AttachTo>
<SubInterface/>
</PortChannel>
</PortChannelInterfaces>
<VlanInterfaces/>
<IPInterfaces/>
<DataAcls/>
<AclInterfaces/>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<EndDevice>ARISTA01T1</EndDevice>
<EndPort>et1</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>switch-t0</StartDevice>
<StartPort>Ethernet0</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="ToRRouter">
<Hostname>switch-t0</Hostname>
<HwSku>Force10-S6000</HwSku>
<ClusterName>AAA00PrdStr00</ClusterName>
</Device>
<Device i:type="LeafRouter">
<Hostname>ARISTA01T1</Hostname>
<HwSku>Arista</HwSku>
</Device>
</Devices>
</PngDec>
<DeviceInfos>
<DeviceInfo>
<EthernetInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>Ethernet0</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>Ethernet4</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>50000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>Ethernet6</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>50000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>Ethernet20</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
</EthernetInterfaces>
<FlowControl>true</FlowControl>
<Height>0</Height>
<HwSku>Force10-S6000</HwSku>
<ManagementInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceInfo>
</DeviceInfos>
<Hostname>switch-t0</Hostname>
<HwSku>Force10-S6000</HwSku>
</DeviceMiniGraph>

View File

@ -3,7 +3,6 @@
"index": "3",
"lanes": "8",
"description": "Eth3/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth3/1",
"pfc_asym": "off",
@ -14,7 +13,6 @@
"index": "3",
"lanes": "9",
"description": "Eth3/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth3/2",
"pfc_asym": "off",
@ -25,7 +23,6 @@
"index": "10",
"lanes": "36,37",
"description": "Eth10/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth10/1",
"pfc_asym": "off",
@ -36,7 +33,6 @@
"index": "25",
"lanes": "98",
"description": "Eth25/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth25/2",
"pfc_asym": "off",
@ -47,7 +43,7 @@
"index": "1",
"lanes": "0,1,2,3",
"fec": "rs",
"description": "Eth1",
"description": "ARISTA01T1:et1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth1",
@ -81,7 +77,6 @@
"index": "28",
"lanes": "109",
"description": "Eth28/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth28/2",
"pfc_asym": "off",
@ -92,7 +87,6 @@
"index": "28",
"lanes": "108",
"description": "Eth28/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth28/1",
"pfc_asym": "off",
@ -103,7 +97,6 @@
"index": "5",
"lanes": "18",
"description": "Eth5/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth5/2",
"pfc_asym": "off",
@ -115,7 +108,6 @@
"lanes": "100,101,102,103",
"fec": "rs",
"description": "Eth26",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth26",
"pfc_asym": "off",
@ -126,7 +118,6 @@
"index": "9",
"lanes": "34,35",
"description": "Eth9/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth9/3",
"pfc_asym": "off",
@ -137,7 +128,6 @@
"index": "27",
"lanes": "104,105",
"description": "Eth27/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth27/1",
"pfc_asym": "off",
@ -148,7 +138,6 @@
"index": "27",
"lanes": "106,107",
"description": "Eth27/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth27/2",
"pfc_asym": "off",
@ -159,7 +148,6 @@
"index": "24",
"lanes": "94,95",
"description": "Eth24/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth24/3",
"pfc_asym": "off",
@ -170,7 +158,6 @@
"index": "32",
"lanes": "126,127",
"description": "Eth32/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth32/2",
"pfc_asym": "off",
@ -181,7 +168,6 @@
"index": "25",
"lanes": "96,97",
"description": "Eth25/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth25/1",
"pfc_asym": "off",
@ -192,7 +178,6 @@
"index": "32",
"lanes": "124,125",
"description": "Eth32/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth32/1",
"pfc_asym": "off",
@ -203,7 +188,6 @@
"index": "23",
"lanes": "90",
"description": "Eth23/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth23/3",
"pfc_asym": "off",
@ -214,7 +198,6 @@
"index": "23",
"lanes": "91",
"description": "Eth23/4",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth23/4",
"pfc_asym": "off",
@ -225,7 +208,6 @@
"index": "24",
"lanes": "92",
"description": "Eth24/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth24/1",
"pfc_asym": "off",
@ -236,7 +218,6 @@
"index": "24",
"lanes": "93",
"description": "Eth24/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth24/2",
"pfc_asym": "off",
@ -247,7 +228,6 @@
"index": "13",
"lanes": "50",
"description": "Eth13/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth13/3",
"pfc_asym": "off",
@ -258,7 +238,6 @@
"index": "13",
"lanes": "51",
"description": "Eth13/4",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth13/4",
"pfc_asym": "off",
@ -269,7 +248,6 @@
"index": "14",
"lanes": "52",
"description": "Eth14/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth14/1",
"pfc_asym": "off",
@ -280,7 +258,6 @@
"index": "14",
"lanes": "53",
"description": "Eth14/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth14/2",
"pfc_asym": "off",
@ -291,7 +268,6 @@
"index": "14",
"lanes": "54,55",
"description": "Eth14/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth14/3",
"pfc_asym": "off",
@ -302,7 +278,6 @@
"index": "25",
"lanes": "99",
"description": "Eth25/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth25/3",
"pfc_asym": "off",
@ -313,7 +288,6 @@
"index": "15",
"lanes": "56,57",
"description": "Eth15/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth15/1",
"pfc_asym": "off",
@ -324,7 +298,6 @@
"index": "29",
"lanes": "113",
"description": "Eth29/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth29/2",
"pfc_asym": "off",
@ -335,7 +308,6 @@
"index": "20",
"lanes": "76,77",
"description": "Eth20/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth20/1",
"pfc_asym": "off",
@ -346,7 +318,6 @@
"index": "19",
"lanes": "74,75",
"description": "Eth19/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth19/3",
"pfc_asym": "off",
@ -357,7 +328,6 @@
"index": "10",
"lanes": "39",
"description": "Eth10/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth10/3",
"pfc_asym": "off",
@ -368,7 +338,6 @@
"index": "19",
"lanes": "72",
"description": "Eth19/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth19/1",
"pfc_asym": "off",
@ -379,7 +348,6 @@
"index": "19",
"lanes": "73",
"description": "Eth19/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth19/2",
"pfc_asym": "off",
@ -390,7 +358,6 @@
"index": "18",
"lanes": "70",
"description": "Eth18/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth18/3",
"pfc_asym": "off",
@ -401,7 +368,6 @@
"index": "18",
"lanes": "71",
"description": "Eth18/4",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth18/4",
"pfc_asym": "off",
@ -412,7 +378,6 @@
"index": "9",
"lanes": "32",
"description": "Eth9/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth9/1",
"pfc_asym": "off",
@ -423,7 +388,6 @@
"index": "9",
"lanes": "33",
"description": "Eth9/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth9/2",
"pfc_asym": "off",
@ -434,7 +398,6 @@
"index": "5",
"lanes": "16,17",
"description": "Eth5/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth5/1",
"pfc_asym": "off",
@ -445,7 +408,6 @@
"index": "28",
"lanes": "111",
"description": "Eth28/4",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth28/4",
"pfc_asym": "off",
@ -456,7 +418,6 @@
"index": "3",
"lanes": "10",
"description": "Eth3/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth3/3",
"pfc_asym": "off",
@ -467,7 +428,6 @@
"index": "3",
"lanes": "11",
"description": "Eth3/4",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth3/4",
"pfc_asym": "off",
@ -478,7 +438,6 @@
"index": "4",
"lanes": "12",
"description": "Eth4/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth4/1",
"pfc_asym": "off",
@ -489,7 +448,6 @@
"index": "4",
"lanes": "13",
"description": "Eth4/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth4/2",
"pfc_asym": "off",
@ -500,7 +458,6 @@
"index": "15",
"lanes": "58",
"description": "Eth15/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth15/2",
"pfc_asym": "off",
@ -511,7 +468,6 @@
"index": "5",
"lanes": "19",
"description": "Eth5/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth5/3",
"pfc_asym": "off",
@ -522,7 +478,6 @@
"index": "15",
"lanes": "59",
"description": "Eth15/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth15/3",
"pfc_asym": "off",
@ -533,7 +488,6 @@
"index": "10",
"lanes": "38",
"description": "Eth10/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth10/2",
"pfc_asym": "off",
@ -544,7 +498,6 @@
"index": "20",
"lanes": "78",
"description": "Eth20/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth20/2",
"pfc_asym": "off",
@ -555,7 +508,6 @@
"index": "18",
"lanes": "68",
"description": "Eth18/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth18/1",
"pfc_asym": "off",
@ -566,7 +518,6 @@
"index": "4",
"lanes": "14,15",
"description": "Eth4/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth4/3",
"pfc_asym": "off",
@ -577,7 +528,6 @@
"index": "23",
"lanes": "89",
"description": "Eth23/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth23/2",
"pfc_asym": "off",
@ -588,7 +538,6 @@
"index": "23",
"lanes": "88",
"description": "Eth23/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth23/1",
"pfc_asym": "off",
@ -599,7 +548,6 @@
"index": "30",
"lanes": "118",
"description": "Eth30/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth30/2",
"pfc_asym": "off",
@ -610,7 +558,6 @@
"index": "30",
"lanes": "119",
"description": "Eth30/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth30/3",
"pfc_asym": "off",
@ -621,7 +568,6 @@
"index": "30",
"lanes": "116,117",
"description": "Eth30/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth30/1",
"pfc_asym": "off",
@ -632,7 +578,6 @@
"index": "29",
"lanes": "114,115",
"description": "Eth29/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth29/3",
"pfc_asym": "off",
@ -644,7 +589,6 @@
"lanes": "80,81,82,83",
"fec": "rs",
"description": "Eth21",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth21",
"pfc_asym": "off",
@ -655,7 +599,6 @@
"index": "29",
"lanes": "112",
"description": "Eth29/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth29/1",
"pfc_asym": "off",
@ -666,7 +609,6 @@
"index": "22",
"lanes": "86,87",
"description": "Eth22/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth22/2",
"pfc_asym": "off",
@ -677,7 +619,6 @@
"index": "28",
"lanes": "110",
"description": "Eth28/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth28/3",
"pfc_asym": "off",
@ -688,7 +629,6 @@
"index": "22",
"lanes": "84,85",
"description": "Eth22/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth22/1",
"pfc_asym": "off",
@ -699,7 +639,6 @@
"index": "8",
"lanes": "31",
"description": "Eth8/4",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth8/4",
"pfc_asym": "off",
@ -710,7 +649,6 @@
"index": "13",
"lanes": "49",
"description": "Eth13/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth13/2",
"pfc_asym": "off",
@ -721,7 +659,6 @@
"index": "13",
"lanes": "48",
"description": "Eth13/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth13/1",
"pfc_asym": "off",
@ -732,7 +669,6 @@
"index": "12",
"lanes": "46,47",
"description": "Eth12/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth12/2",
"pfc_asym": "off",
@ -743,7 +679,6 @@
"index": "8",
"lanes": "30",
"description": "Eth8/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth8/3",
"pfc_asym": "off",
@ -754,7 +689,6 @@
"index": "8",
"lanes": "29",
"description": "Eth8/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth8/2",
"pfc_asym": "off",
@ -766,7 +700,6 @@
"lanes": "40,41,42,43",
"fec": "rs",
"description": "Eth11",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth11",
"pfc_asym": "off",
@ -778,7 +711,6 @@
"lanes": "120,121,122,123",
"fec": "rs",
"description": "Eth31",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth31",
"pfc_asym": "off",
@ -789,7 +721,6 @@
"index": "8",
"lanes": "28",
"description": "Eth8/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth8/1",
"pfc_asym": "off",
@ -800,7 +731,6 @@
"index": "17",
"lanes": "66,67",
"description": "Eth17/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth17/2",
"pfc_asym": "off",
@ -812,7 +742,6 @@
"lanes": "60,61,62,63",
"fec": "rs",
"description": "Eth16",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth16",
"pfc_asym": "off",
@ -823,7 +752,6 @@
"index": "17",
"lanes": "64,65",
"description": "Eth17/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth17/1",
"pfc_asym": "off",
@ -834,7 +762,6 @@
"index": "12",
"lanes": "44,45",
"description": "Eth12/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth12/1",
"pfc_asym": "off",
@ -857,7 +784,6 @@
"index": "20",
"lanes": "79",
"description": "Eth20/3",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth20/3",
"pfc_asym": "off",
@ -868,7 +794,6 @@
"index": "18",
"lanes": "69",
"description": "Eth18/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth18/2",
"pfc_asym": "off",
@ -879,7 +804,6 @@
"index": "7",
"lanes": "24,25",
"description": "Eth7/1",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth7/1",
"pfc_asym": "off",
@ -890,7 +814,6 @@
"index": "7",
"lanes": "26,27",
"description": "Eth7/2",
"admin_status": "up",
"mtu": "9100",
"alias": "Eth7/2",
"pfc_asym": "off",

View File

@ -16,7 +16,7 @@ class TestCfgGenPlatformJson(TestCase):
def setUp(self):
self.test_dir = os.path.dirname(os.path.realpath(__file__))
self.script_file = utils.PYTHON_INTERPRETTER + ' ' + os.path.join(self.test_dir, '..', 'sonic-cfggen')
self.sample_graph_simple = os.path.join(self.test_dir, 'simple-sample-graph.xml')
self.platform_sample_graph = os.path.join(self.test_dir, 'platform-sample-graph.xml')
self.platform_json = os.path.join(self.test_dir, 'sample_platform.json')
self.hwsku_json = os.path.join(self.test_dir, 'sample_hwsku.json')
@ -43,13 +43,13 @@ class TestCfgGenPlatformJson(TestCase):
self.assertEqual(output, '')
def test_print_data(self):
argument = '-m "' + self.sample_graph_simple + '" --print-data'
argument = '-m "' + self.platform_sample_graph + '" --print-data'
output = self.run_script(argument)
self.assertTrue(len(output.strip()) > 0)
# Check whether all interfaces present or not as per platform.json
def test_platform_json_interfaces_keys(self):
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT.keys()|list"'
argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT.keys()|list"'
output = self.run_script(argument)
self.maxDiff = None
expected = "['Ethernet8', 'Ethernet9', 'Ethernet36', 'Ethernet98', 'Ethernet0', 'Ethernet6', 'Ethernet4', 'Ethernet109', 'Ethernet108', 'Ethernet18', 'Ethernet100', 'Ethernet34', 'Ethernet104', 'Ethernet106', 'Ethernet94', 'Ethernet126', 'Ethernet96', 'Ethernet124', 'Ethernet90', 'Ethernet91', 'Ethernet92', 'Ethernet93', 'Ethernet50', 'Ethernet51', 'Ethernet52', 'Ethernet53', 'Ethernet54', 'Ethernet99', 'Ethernet56', 'Ethernet113', 'Ethernet76', 'Ethernet74', 'Ethernet39', 'Ethernet72', 'Ethernet73', 'Ethernet70', 'Ethernet71', 'Ethernet32', 'Ethernet33', 'Ethernet16', 'Ethernet111', 'Ethernet10', 'Ethernet11', 'Ethernet12', 'Ethernet13', 'Ethernet58', 'Ethernet19', 'Ethernet59', 'Ethernet38', 'Ethernet78', 'Ethernet68', 'Ethernet14', 'Ethernet89', 'Ethernet88', 'Ethernet118', 'Ethernet119', 'Ethernet116', 'Ethernet114', 'Ethernet80', 'Ethernet112', 'Ethernet86', 'Ethernet110', 'Ethernet84', 'Ethernet31', 'Ethernet49', 'Ethernet48', 'Ethernet46', 'Ethernet30', 'Ethernet29', 'Ethernet40', 'Ethernet120', 'Ethernet28', 'Ethernet66', 'Ethernet60', 'Ethernet64', 'Ethernet44', 'Ethernet20', 'Ethernet79', 'Ethernet69', 'Ethernet24', 'Ethernet26']"
@ -59,21 +59,27 @@ class TestCfgGenPlatformJson(TestCase):
# Check specific Interface with it's proper configuration as per platform.json
def test_platform_json_specific_ethernet_interfaces(self):
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT[\'Ethernet8\']"'
argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT[\'Ethernet8\']"'
output = self.run_script(argument)
self.maxDiff = None
expected = "{'index': '3', 'lanes': '8', 'description': 'Eth3/1', 'admin_status': 'up', 'mtu': '9100', 'alias': 'Eth3/1', 'pfc_asym': 'off', 'speed': '25000', 'tpid': '0x8100'}"
expected = "{'index': '3', 'lanes': '8', 'description': 'Eth3/1', 'mtu': '9100', 'alias': 'Eth3/1', 'pfc_asym': 'off', 'speed': '25000', 'tpid': '0x8100'}"
self.assertEqual(utils.to_dict(output.strip()), utils.to_dict(expected))
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT[\'Ethernet112\']"'
argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT[\'Ethernet112\']"'
output = self.run_script(argument)
self.maxDiff = None
expected = "{'index': '29', 'lanes': '112', 'description': 'Eth29/1', 'admin_status': 'up', 'mtu': '9100', 'alias': 'Eth29/1', 'pfc_asym': 'off', 'speed': '25000', 'tpid': '0x8100'}"
expected = "{'index': '29', 'lanes': '112', 'description': 'Eth29/1', 'mtu': '9100', 'alias': 'Eth29/1', 'pfc_asym': 'off', 'speed': '25000', 'tpid': '0x8100'}"
self.assertEqual(utils.to_dict(output.strip()), utils.to_dict(expected))
argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT[\'Ethernet4\']"'
output = self.run_script(argument)
self.maxDiff = None
expected = "{'index': '2', 'lanes': '4,5', 'description': 'Eth2/1', 'admin_status': 'up', 'mtu': '9100', 'alias': 'Eth2/1', 'pfc_asym': 'off', 'speed': '50000', 'tpid': '0x8100'}"
print(output.strip())
self.assertEqual(utils.to_dict(output.strip()), utils.to_dict(expected))
# Check all Interface with it's proper configuration as per platform.json
def test_platform_json_all_ethernet_interfaces(self):
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT"'
argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT"'
output = self.run_script(argument)
self.maxDiff = None