[minigraph]: Add min_links attribute to PORTCHANNEL configuration table (#2053)
The default min_links value is the ceiling value of 75% of total number of members. Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
This commit is contained in:
parent
51a8d8ecfa
commit
f7024424bb
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
import calendar
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
@ -188,9 +189,9 @@ def parse_dpg(dpg, hname):
|
||||
intfs_inpc.append(pcmbr_list[i])
|
||||
pc_members[pcintfname + KEY_SEPARATOR + pcmbr_list[i]] = {'NULL': 'NULL'}
|
||||
if pcintf.find(str(QName(ns, "Fallback"))) != None:
|
||||
pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text}
|
||||
pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text, 'min_links': str(int(math.ceil(len() * 0.75)))}
|
||||
else:
|
||||
pcs[pcintfname] = {'members': pcmbr_list}
|
||||
pcs[pcintfname] = {'members': pcmbr_list, 'min_links': str(int(math.ceil(len(pcmbr_list) * 0.75)))}
|
||||
|
||||
vlanintfs = child.find(str(QName(ns, "VlanInterfaces")))
|
||||
vlan_intfs = []
|
||||
|
@ -115,12 +115,12 @@ class TestCfgGen(TestCase):
|
||||
def test_minigraph_portchannels(self):
|
||||
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v PORTCHANNEL'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet4'], 'mtu': '9100'}}")
|
||||
self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}")
|
||||
|
||||
def test_minigraph_portchannel_with_more_member(self):
|
||||
argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v PORTCHANNEL'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}")
|
||||
self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '3', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}")
|
||||
|
||||
def test_minigraph_portchannel_members(self):
|
||||
argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v "PORTCHANNEL_MEMBER.keys()"'
|
||||
|
@ -87,7 +87,7 @@ class TestCfgGenCaseInsensitive(TestCase):
|
||||
def test_minigraph_portchannels(self):
|
||||
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v PORTCHANNEL'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet4'], 'mtu': '9100'}}")
|
||||
self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}")
|
||||
|
||||
def test_minigraph_console_port(self):
|
||||
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v CONSOLE_PORT'
|
||||
|
Reference in New Issue
Block a user