diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-04 20:21:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 20:21:42 +0100 |
commit | cb3ef8a7856c54db0741d65fd3d4564a0aadb6c6 (patch) | |
tree | dedf277f915fcac6dc1fb750d6bfd89e309138fd /python/vyos | |
parent | e295df224d64296d371e19c9582bab683a1615a7 (diff) | |
parent | e6e49ad856e1138d3e57f1e7f8c9def0cb5d3ab8 (diff) | |
download | vyos-1x-cb3ef8a7856c54db0741d65fd3d4564a0aadb6c6.tar.gz vyos-1x-cb3ef8a7856c54db0741d65fd3d4564a0aadb6c6.zip |
Merge pull request #240 from thomas-mangin/2057-strict
ifconfig: T2057: allow unknown config keys, and fix variable name ref.
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/ifconfig.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 1a2fad46f..afcf4e96f 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -277,10 +277,9 @@ class Interface(Control): self.config = deepcopy(self.default) self.config['ifname'] = ifname - for k in kargs: - if k not in self.options: - raise ConfigError('invalid option {} for {}'.format(k,self.__class__)) - self.config[k] = kargs[k] + for k in self.options: + if k in kargs: + self.config[k] = kargs[k] for k in self.required: if k not in kargs: @@ -1278,8 +1277,8 @@ class VLANIf(Interface): opt_e = 'egress-qos-map ' + egress_qos # create interface in the system - cmd = 'ip link add link {intf} name {intf}.{vlan} type vlan {proto} id {vlan} {opt_e} {opt_i}' \ - .format(intf=self.config['ifname'], vlan=self._vlan_id, proto=ethertype, opt_e=opt_e, opt_i=opt_i) + cmd = 'ip link add link {ifname} name {ifname}.{vlan} type vlan {proto} id {vlan} {opt_e} {opt_i}' \ + .format(ifname=self.config['ifname'], vlan=self._vlan_id, proto=ethertype, opt_e=opt_e, opt_i=opt_i) self._cmd(cmd) # return new object mapping to the newly created interface @@ -1534,7 +1533,7 @@ class MACVLANIf(VLANIf): super().__init__(ifname, **kargs) def _create(self): - cmd = 'ip link add {intf} link {link} type macvlan mode {mode}'.format(**self.config) + cmd = 'ip link add {ifname} link {link} type macvlan mode {mode}'.format(**self.config) self._cmd(cmd) @staticmethod @@ -2003,8 +2002,7 @@ class VXLANIf(Interface): if self.config['dev']: dev = 'dev {}'.format(self.config['dev']) - cmd = 'ip link add {intf} type vxlan id {vni} {grp_rem} {dev} dstport {port}' \ - .format(intf=self.config['ifname'], vni=self.config['vni'], grp_rem=group, dev=dev, port=self.config['port']) + cmd = 'ip link add {ifname} type vxlan id {vni} {group} {dev} dstport {port}'.format(**config) self._cmd(cmd) @staticmethod |