Loading src/device/service/drivers/gnmi_openconfig/handlers/Acl.py +17 −8 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class AclHandler(_Handler): y_entries = y_set.create_path('acl-entries') for entry in rs.get('entries', []): seq = int(entry['sequence_id']) m_ = entry['match'] m_ = entry.get('match', dict()) src_address = m_.get('src_address', '0.0.0.0/0') dst_address = m_.get('dst_address', '0.0.0.0/0') src_port = m_.get('src_port') Loading @@ -110,10 +110,9 @@ class AclHandler(_Handler): if src_port or dst_port: y_trans = y_e.create_path('transport') if src_port: y_trans.create_path("config/source-port", int(src_port)) y_trans.create_path('config/source-port', int(src_port)) if dst_port: y_trans.create_path("config/destination-port", int(dst_port)) y_ipv4.create_path('config/protocol', int(proto)) y_trans.create_path('config/destination-port', int(dst_port)) y_act = y_e.create_path('actions') y_act.create_path('config/forwarding-action', act) Loading Loading @@ -183,14 +182,24 @@ class AclHandler(_Handler): act = ace.get('actions', {}).get('config', {}).get('forwarding-action', 'DROP') fwd_tfs = _OC_TFS_FWD_ACTION[act] ipv4_cfg = ace.get('ipv4', {}).get('config', {}) transport_cfg = ace.get('transport', {}).get('config', {}) match_conditions = dict() if 'source-address' in ipv4_cfg: match_conditions['src_address'] = ipv4_cfg['source-address'] if 'destination-address' in ipv4_cfg: match_conditions['dst_address'] = ipv4_cfg['destination-address'] if 'protocol' in ipv4_cfg: match_conditions['protocol'] = ipv4_cfg['protocol'] if 'source-port' in transport_cfg: match_conditions['src_port'] = transport_cfg['source-port'] if 'destination-port' in transport_cfg: match_conditions['dst_port'] = transport_cfg['destination-port'] rule_set['entries'].append( { 'sequence_id': seq, 'match': { 'src_address': ipv4_cfg.get('source-address', ''), 'dst_address': ipv4_cfg.get('destination-address', ''), }, 'match': match_conditions, 'action': {'forward_action': fwd_tfs}, } ) Loading Loading
src/device/service/drivers/gnmi_openconfig/handlers/Acl.py +17 −8 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class AclHandler(_Handler): y_entries = y_set.create_path('acl-entries') for entry in rs.get('entries', []): seq = int(entry['sequence_id']) m_ = entry['match'] m_ = entry.get('match', dict()) src_address = m_.get('src_address', '0.0.0.0/0') dst_address = m_.get('dst_address', '0.0.0.0/0') src_port = m_.get('src_port') Loading @@ -110,10 +110,9 @@ class AclHandler(_Handler): if src_port or dst_port: y_trans = y_e.create_path('transport') if src_port: y_trans.create_path("config/source-port", int(src_port)) y_trans.create_path('config/source-port', int(src_port)) if dst_port: y_trans.create_path("config/destination-port", int(dst_port)) y_ipv4.create_path('config/protocol', int(proto)) y_trans.create_path('config/destination-port', int(dst_port)) y_act = y_e.create_path('actions') y_act.create_path('config/forwarding-action', act) Loading Loading @@ -183,14 +182,24 @@ class AclHandler(_Handler): act = ace.get('actions', {}).get('config', {}).get('forwarding-action', 'DROP') fwd_tfs = _OC_TFS_FWD_ACTION[act] ipv4_cfg = ace.get('ipv4', {}).get('config', {}) transport_cfg = ace.get('transport', {}).get('config', {}) match_conditions = dict() if 'source-address' in ipv4_cfg: match_conditions['src_address'] = ipv4_cfg['source-address'] if 'destination-address' in ipv4_cfg: match_conditions['dst_address'] = ipv4_cfg['destination-address'] if 'protocol' in ipv4_cfg: match_conditions['protocol'] = ipv4_cfg['protocol'] if 'source-port' in transport_cfg: match_conditions['src_port'] = transport_cfg['source-port'] if 'destination-port' in transport_cfg: match_conditions['dst_port'] = transport_cfg['destination-port'] rule_set['entries'].append( { 'sequence_id': seq, 'match': { 'src_address': ipv4_cfg.get('source-address', ''), 'dst_address': ipv4_cfg.get('destination-address', ''), }, 'match': match_conditions, 'action': {'forward_action': fwd_tfs}, } ) Loading