def show_stale_flows(args, sort_by='table'): config.get_models(args, { "elan_elan_instances", "elan_elan_interfaces", "ietf_interfaces_interfaces", "ietf_interfaces_interfaces_state", "interface_service_bindings_service_bindings", "l3vpn_vpn_interfaces", # "mip_mac", "neutron_neutron", "odl_fib_fib_entries", "odl_interface_meta_if_index_interface_map", "odl_l3vpn_vpn_instance_to_vpn_id", "odl_inventory_nodes", "odl_inventory_nodes_operational"}) compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping() nports = config.gmodels.neutron_neutron.get_objects_by_key(obj=Neutron.PORTS) modules = [args.modules] if args.modules else tbls.get_all_modules() for flow in utils.sort(get_stale_flows(modules), sort_by): host = compute_map.get(flow.get('dpnid'), flow.get('dpnid')) ip_list = get_ips_for_iface(nports, flow.get('ifname')) if ip_list: flow['iface-ips'] = ip_list result = "Table:{}, Host:{}, FlowId:{}{}".format(flow['table'], host, flow['id'], utils.show_optionals(flow)) print(result) # path = get_data_path('flows', flow) # print("http://192.168.2.32:8383/restconf/config/{}".format(path)) if not args.metaonly: print("Flow: ", utils.format_json(args, flow_parser.parse_flow(flow['flow'])))
def show_stale_flows(args, sort_by='table'): config.get_models(args, { "elan_elan_instances", "elan_elan_interfaces", "ietf_interfaces_interfaces", "ietf_interfaces_interfaces_state", "interface_service_bindings_service_bindings", "l3vpn_vpn_interfaces", # "mip_mac", "neutron_neutron", "odl_fib_fib_entries", "odl_interface_meta_if_index_interface_map", "odl_l3vpn_vpn_instance_to_vpn_id", "odl_inventory_nodes", "odl_inventory_nodes_operational"}) compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping() nports = config.gmodels.neutron_neutron.get_objects_by_key(obj=Neutron.PORTS) modules = [args.modules] if args.modules else tbls.get_all_modules() for flow in utils.sort(get_stale_flows(modules), sort_by): host = compute_map.get(flow.get('dpnid'), flow.get('dpnid')) ip_list = get_ips_for_iface(nports, flow.get('ifname')) if ip_list: flow['iface-ips'] = ip_list flow['host'] = host result = utils.show_all(flow) print(result) # path = get_data_path('flows', flow) # print("http://192.168.2.32:8383/restconf/config/{}".format(path)) if not args.metaonly: print("Flow: ", utils.format_json(args, flow_parser.parse_flow(flow['flow'])))
def show_all_flows(args): config.get_models( args, { "elan_elan_instances", "elan_elan_interfaces", "ietf_interfaces_interfaces", "ietf_interfaces_interfaces_state", "interface_service_bindings_service_bindings", "l3vpn_vpn_interfaces", "neutron_neutron", "odl_fib_fib_entries", "odl_interface_meta_if_index_interface_map", "odl_l3vpn_vpn_instance_to_vpn_id", "odl_inventory_nodes", "odl_inventory_nodes_operational" }) modules = [args.modules] if args.modules else tbls.get_all_modules() dump_flows(args, modules)
def show_all_flows(args): config.get_models(args, { "elan_elan_instances", "elan_elan_interfaces", "ietf_interfaces_interfaces", "ietf_interfaces_interfaces_state", "interface_service_bindings_service_bindings", "l3vpn_vpn_interfaces", "neutron_neutron", "odl_fib_fib_entries", "odl_interface_meta_if_index_interface_map", "odl_l3vpn_vpn_instance_to_vpn_id", "odl_inventory_nodes", "odl_inventory_nodes_operational"}) modules = [args.modules] if args.modules else tbls.get_all_modules() dump_flows(args, modules)