mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: mstpctl: complete ifquery -r support
Ticket: CM-7841 Reviewed By: roopa, julien Testing Done: tested all the bridge attributes added 'ifquery -r' support for 'mstpctl-portpathcost', 'mstpctl-treeportcost', 'mstpctl-portautoedge', 'mstpctl-portbpdufilter', 'mstpctl-portnetwork' Below is the sample configuration and output root@dell-s3000-02:~# ifquery -a auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto br0 iface br0 bridge-vlan-aware yes bridge-ports swp42 swp43 mstpctl-fdelay 14 mstpctl-txholdcount 5 mstpctl-forcevers rstp mstpctl-maxhops 14 mstpctl-treeprio 32768 mstpctl-maxage 19 mstpctl-hello 3 mstpctl-ageing 200 auto swp42 iface swp42 mstpctl-portadminedge yes mstpctl-portbpdufilter yes mstpctl-portnetwork yes mstpctl-portautoedge yes mstpctl-treeportprio 127 mstpctl-portpathcost 10 mstpctl-portrestrtcn yes mstpctl-portrestrrole yes mstpctl-bpduguard yes mstpctl-treeportcost 100 mstpctl-portp2p yes auto swp43 iface swp43 mstpctl-portadminedge yes mstpctl-portbpdufilter yes mstpctl-portnetwork yes mstpctl-portautoedge yes mstpctl-treeportprio 127 mstpctl-portpathcost 10 mstpctl-portrestrtcn yes mstpctl-portrestrrole yes mstpctl-bpduguard yes mstpctl-treeportcost 100 mstpctl-portp2p yes root@dell-s3000-02:~# ifquery -ra auto swp42 iface swp42 mstpctl-portautoedge yes mstpctl-portbpdufilter yes mstpctl-portpathcost 10 mstpctl-treeportcost 100 mstpctl-portnetwork yes mstpctl-portadminedge yes mstpctl-portp2p yes mstpctl-portrestrrole yes mstpctl-portrestrtcn yes mstpctl-bpduguard yes link-speed 0 link-duplex half link-autoneg off auto swp43 iface swp43 mstpctl-portautoedge yes mstpctl-portbpdufilter yes mstpctl-portpathcost 10 mstpctl-treeportcost 100 mstpctl-portnetwork yes mstpctl-portadminedge yes mstpctl-portp2p yes mstpctl-portrestrrole yes mstpctl-portrestrtcn yes mstpctl-bpduguard yes link-speed 0 link-duplex half link-autoneg off auto br0 iface br0 vxlan-ageing 300 bridge-vlan-aware yes bridge-mcqifaddr 0 bridge-mcquerier 0 bridge-mcsnoop 1 bridge-mcrouter 1 bridge-stp yes bridge-ports swp43 swp42 mstpctl-portadminedge swp42=yes swp43=yes mstpctl-fdelay 14 mstpctl-portnetwork swp42=yes swp43=yes mstpctl-txholdcount 5 mstpctl-maxage 19 mstpctl-portbpdufilter swp42=yes swp43=yes mstpctl-maxhops 14 mstpctl-portrestrtcn swp42=yes swp43=yes mstpctl-portpathcost swp42=10 swp43=10 mstpctl-portautoedge swp42=yes swp43=yes mstpctl-hello 3 mstpctl-portrestrrole swp42=yes swp43=yes mstpctl-bpduguard swp42=yes swp43=yes mstpctl-ageing 200 mstpctl-treeportcost swp42=100 swp43=100 mstpctl-portp2p swp42=yes swp43=yes Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
This commit is contained in:
@@ -579,7 +579,9 @@ class mstpctl(moduleBase):
|
||||
|
||||
ports = self.brctlcmd.get_bridge_ports(ifaceobjrunning.name)
|
||||
if ports:
|
||||
portconfig = {'mstpctl-portnetwork' : '',
|
||||
portconfig = {'mstpctl-portautoedge' : '',
|
||||
'mstpctl-portbpdufilter' : '',
|
||||
'mstpctl-portnetwork' : '',
|
||||
'mstpctl-portpathcost' : '',
|
||||
'mstpctl-portadminedge' : '',
|
||||
'mstpctl-portautoedge' : '',
|
||||
@@ -591,6 +593,16 @@ class mstpctl(moduleBase):
|
||||
'mstpctl-treeportcost' : ''}
|
||||
|
||||
for p in ports:
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(ifaceobjrunning.name,
|
||||
p, 'portautoedge')
|
||||
if v and v != 'no':
|
||||
portconfig['mstpctl-portautoedge'] += ' %s=%s' %(p, v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(ifaceobjrunning.name,
|
||||
p, 'portbpdufilter')
|
||||
if v and v != 'no':
|
||||
portconfig['mstpctl-portbpdufilter'] += ' %s=%s' %(p, v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(ifaceobjrunning.name,
|
||||
p, 'portnetwork')
|
||||
if v and v != 'no':
|
||||
@@ -634,11 +646,17 @@ class mstpctl(moduleBase):
|
||||
# 'default'):
|
||||
# portconfig['mstpctl-treeportprio'] += ' %s=%s' %(p, v)
|
||||
|
||||
#v = self.mstpctlcmd.get_bridgeport_attr(ifaceobjrunning.name,
|
||||
# p, 'treecost')
|
||||
#if v and v != self.get_mod_subattr('mstpctl-treeportcost',
|
||||
# 'default'):
|
||||
# portconfig['mstpctl-treeportcost'] += ' %s=%s' %(p, v)
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(ifaceobjrunning.name,
|
||||
p, 'portpathcost')
|
||||
if v and v != self.get_mod_subattr('mstpctl-portpathcost',
|
||||
'default'):
|
||||
portconfig['mstpctl-portpathcost'] += ' %s=%s' %(p, v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(ifaceobjrunning.name,
|
||||
p, 'treeportcost')
|
||||
if v and v != self.get_mod_subattr('mstpctl-treeportcost',
|
||||
'default'):
|
||||
portconfig['mstpctl-treeportcost'] += ' %s=%s' %(p, v)
|
||||
|
||||
bridgeattrdict.update({k : [v] for k, v in portconfig.items()
|
||||
if v})
|
||||
@@ -893,11 +911,38 @@ class mstpctl(moduleBase):
|
||||
# if userspace stp not set, return
|
||||
if self.sysctl_get('net.bridge.bridge-stp-user-space') != '1':
|
||||
return
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(bridgename,
|
||||
ifaceobjrunning.name,
|
||||
'portautoedge')
|
||||
if v and v != 'no':
|
||||
ifaceobjrunning.update_config('mstpctl-portautoedge', v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(bridgename,
|
||||
ifaceobjrunning.name,
|
||||
'portbpdufilter')
|
||||
if v and v != 'no':
|
||||
ifaceobjrunning.update_config('mstpctl-portbpdufilter', v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(bridgename,
|
||||
ifaceobjrunning.name,
|
||||
'portpathcost')
|
||||
if v and v != self.get_mod_subattr('mstpctl-portpathcost',
|
||||
'default'):
|
||||
ifaceobjrunning.update_config('mstpctl-portpathcost', v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(bridgename,
|
||||
ifaceobjrunning.name,
|
||||
'treeportcost')
|
||||
if v and v != self.get_mod_subattr('mstpctl-treeportcost',
|
||||
'default'):
|
||||
ifaceobjrunning.update_config('mstpctl-treeportcost', v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(bridgename,
|
||||
ifaceobjrunning.name,
|
||||
'portnetwork')
|
||||
if v and v != 'no':
|
||||
ifaceobjrunning.update_config('mstpctl-network', v)
|
||||
ifaceobjrunning.update_config('mstpctl-portnetwork', v)
|
||||
|
||||
# XXX: Can we really get path cost of a port ???
|
||||
#v = self.mstpctlcmd.get_portpathcost(ifaceobjrunning.name, p)
|
||||
@@ -921,7 +966,7 @@ class mstpctl(moduleBase):
|
||||
ifaceobjrunning.update_config('mstpctl-portrestrrole', v)
|
||||
|
||||
v = self.mstpctlcmd.get_bridgeport_attr(bridgename,
|
||||
ifaceobjrunning.name, 'restrtcn')
|
||||
ifaceobjrunning.name, 'portrestrtcn')
|
||||
if v and v != 'no':
|
||||
ifaceobjrunning.update_config('mstpctl-portrestrtcn', v)
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ class mstpctlutil(utilsBase):
|
||||
'bpduguard' : 'bpdu-guard-port',
|
||||
'portautoedge' : 'auto-edge-port',
|
||||
'portnetwork' : 'network-port',
|
||||
'portbpdufilter' : 'bpdufilter-port'}
|
||||
'portbpdufilter' : 'bpdufilter-port',
|
||||
'portpathcost' : 'external-port-cost',
|
||||
'treeportcost' : 'internal-port-cost'}
|
||||
|
||||
def __init__(self, *args, **kargs):
|
||||
utilsBase.__init__(self, *args, **kargs)
|
||||
|
||||
Reference in New Issue
Block a user