Commit 51fb0c51 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component - RESTCONF OpenConfig Driver:

- Filter out default values to prevent injecting wrong values on ACL rules
parent 48cb70eb
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -185,19 +185,19 @@ class AclRuleSetHandler:
            entry_match = entry.get('match', dict())

            ipv4_config = dict()
            if 'protocol' in entry_match:
            if 'protocol' in entry_match and entry_match['protocol'] > 0:
                ipv4_config['protocol'] = _TFS_2_OC_PROTOCOL[entry_match['protocol']]
            if 'src_address' in entry_match:
            if 'src_address' in entry_match and len(entry_match['src_address']) > 0:
                ipv4_config['source-address'] = entry_match['src_address']
            if 'dst_address' in entry_match:
            if 'dst_address' in entry_match and len(entry_match['dst_address']) > 0:
                ipv4_config['destination-address'] = entry_match['dst_address']
            if len(ipv4_config) > 0:
                oc_acl_entry.setdefault('ipv4', dict())['config'] = ipv4_config

            transport_config = dict()
            if 'src_port' in entry_match:
            if 'src_port' in entry_match and entry_match['src_port'] > 0:
                transport_config['source-port'] = entry_match['src_port']
            if 'dst_port' in entry_match:
            if 'dst_port' in entry_match and entry_match['dst_port'] > 0:
                transport_config['destination-port'] = entry_match['dst_port']
            if len(transport_config) > 0:
                oc_acl_entry.setdefault('transport', dict())['config'] = transport_config