コード例 #1
0
ファイル: flows.py プロジェクト: ww09/netvirt
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_config",
            "odl_inventory_nodes_operational"
        })
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping(
    )
    nports = config.gmodels.neutron_neutron.get_ports_by_key()

    for flow in utils.sort(get_stale_flows(['ifm', 'acl', 'elan', 'l3vpn']),
                           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
コード例 #2
0
ファイル: flows.py プロジェクト: opendaylight/netvirt
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'])))
コード例 #3
0
def dump_flows(args, modules=None, sort_by='table', filter_by=None):
    config.get_models(
        args, {
            "neutron_neutron", "odl_inventory_nodes_operational",
            "network_topology_network_topology_operational"
        })
    filter_by = filter_by if filter_by else []
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping(
    )
    node_map = config.gmodels.network_topology_network_topology_operational.get_dpn_host_mapping(
    )
    nports = config.gmodels.neutron_neutron.get_objects_by_key(
        obj=Neutron.PORTS)
    for flow in utils.sort(get_all_flows(args, modules, filter_by), sort_by):
        dpnid = flow.get('dpnid')
        host = compute_map.get(dpnid)
        if not host:
            host = node_map.get(int(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)
        if not args.metaonly:
            print("Flow: {}".format(
                utils.format_json(args, flow_parser.parse_flow(flow['flow']))))
コード例 #4
0
ファイル: flows.py プロジェクト: vthapar/odltools
def show_learned_mac_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",
        # "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"})
    # nports = config.gmodels.neutron_neutron.get_ports_by_key(key='mac-address')
    nports = config.gmodels.neutron_neutron.get_objects_by_key(obj=Neutron.PORTS, key='mac-address')
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping()

    flows = utils.sort(get_all_flows(args, ['elan']), 'table')
    for flow_info in flows:
        flow = flow_info.get('flow')
        dpnid = flow_info.get('dpnid')
        host = compute_map.get(dpnid, dpnid)
        if ((flow_info.get('table') == 50 and flow.get('idle-timeout') == 300
             and not nports.get(flow_info.get('src-mac')))
            or (flow_info.get('table') == 51 and not nports.get(flow_info.get('dst-mac')))):  # NOQA

            result = 'Table:{}, Host:{}, FlowId:{}{}'.format(
                flow_info.get('table'), host, flow.get('id'),
                utils.show_optionals(flow_info))
            print(result)
            print("Flow: {}".format(utils.format_json(args, flow_parser.parse_flow(flow))))
コード例 #5
0
ファイル: flows.py プロジェクト: vthapar/odltools
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'])))
コード例 #6
0
ファイル: flows.py プロジェクト: opendaylight/netvirt
def show_learned_mac_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",
        # "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"})
    # nports = config.gmodels.neutron_neutron.get_ports_by_key(key='mac-address')
    nports = config.gmodels.neutron_neutron.get_objects_by_key(obj=Neutron.PORTS, key='mac-address')
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping()

    flows = utils.sort(get_all_flows(args, ['elan']), 'table')
    for flow_info in flows:
        flow = flow_info.get('flow')
        dpnid = flow_info.get('dpnid')
        host = compute_map.get(dpnid, dpnid)
        if ((flow_info.get('table') == 50 and flow.get('idle-timeout') == 300
             and not nports.get(flow_info.get('src-mac')))
            or (flow_info.get('table') == 51 and not nports.get(flow_info.get('dst-mac')))):  # NOQA

            flow['host'] = host
            result = utils.show_all(flow_info)
            print(result)
            print("Flow: {}".format(utils.format_json(args, flow_parser.parse_flow(flow))))
コード例 #7
0
ファイル: analyze.py プロジェクト: opendaylight/netvirt
def analyze_neutron_port(args, port, iface, ifstate):
    for flow in utils.sort(flows.get_all_flows(args, ['all']), 'table'):
        if ((flow.get('ifname') == port['uuid']) or
                (flow.get('lport') and ifstate and flow['lport'] == ifstate.get('if-index')) or
                (iface['name'] == flow.get('ifname'))):
            result = utils.show_all(flow)
            print(result)
            print("Flow: {}".format(utils.format_json(None, flow_parser.parse_flow(flow.get('flow')))))
コード例 #8
0
def analyze_neutron_port(args, port, iface, ifstate):
    for flow in utils.sort(flows.get_all_flows(args, ['all']), 'table'):
        if ((flow.get('ifname') == port['uuid']) or
                (flow.get('lport') and ifstate and flow['lport'] == ifstate.get('if-index')) or
                (iface['name'] == flow.get('ifname'))):
            result = 'Table:{},FlowId:{}{}'.format(
                flow['table'], flow['id'],
                utils.show_optionals(flow))
            print(result)
            print("Flow: {}".format(utils.format_json(None, flow_parser.parse_flow(flow.get('flow')))))
コード例 #9
0
ファイル: flows.py プロジェクト: ww09/netvirt
def show_dup_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",
            # "mip_mac",
            "odl_fib_fib_entries",
            "odl_interface_meta_if_index_interface_map",
            "odl_l3vpn_vpn_instance_to_vpn_id",
            "odl_inventory_nodes_config",
            "odl_inventory_nodes_operational"
        })
    mmac = {}  # config.gmodels.mip_mac.get_entries_by_key()
    einsts = config.gmodels.elan_elan_instances.get_clist_by_key()
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping(
    )

    flows = utils.sort(get_all_flows(['elan']), 'table')
    matches = collections.defaultdict(list)
    for flow in flows:
        dup_key = get_key_for_dup_detect(args, flow)
        if dup_key:
            if matches and matches.get(dup_key):
                matches[dup_key].append(flow)
            else:
                matches[dup_key].append(flow)
    for k, v in matches.iteritems():
        if len(v) > 1:
            dpnid = k.split(':')[0]
            host = compute_map.get(dpnid, dpnid)
            result = 'Host:{}, FlowCount:{}, MatchKey:{}, ElanTag:{}'.format(
                host, len(v), k, v[0].get('elan-tag'))
            print result
            for idx, flow in enumerate(v):
                result = "Duplicate"
                mac_addr = flow.get('dst-mac')
                if mac_addr and mmac.get(mac_addr):
                    result = is_correct_elan_flow(flow, mmac.get(mac_addr),
                                                  einsts, host)
                print '    {} Flow-{}:{}'.format(
                    result, idx,
                    utils.format_json(args,
                                      flow_parser.parse_flow(
                                          flow.get('flow'))))
コード例 #10
0
ファイル: flows.py プロジェクト: opendaylight/netvirt
def show_elan_flows(args):
    config.get_models(args, {
        "elan_elan_instances",
        "elan_elan_interfaces",
        "ietf_interfaces_interfaces",
        "ietf_interfaces_interfaces_state",
        "odl_interface_meta_if_index_interface_map",
        "odl_inventory_nodes",
        "odl_inventory_nodes_operational"})
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping()
    for flow in utils.sort(get_all_flows(args, modules=['elan']), 'id'):
        host = compute_map.get(flow.get('dpnid'), flow.get('dpnid'))
        flow['host'] = host
        result = "{}, Flow:{}".format(utils.show_all(flow),
                                      utils.format_json(args, flow_parser.parse_flow(flow['flow'])))
        print(result)
コード例 #11
0
ファイル: flows.py プロジェクト: vthapar/odltools
def show_elan_flows(args):
    config.get_models(args, {
        "elan_elan_instances",
        "elan_elan_interfaces",
        "ietf_interfaces_interfaces",
        "ietf_interfaces_interfaces_state",
        "odl_interface_meta_if_index_interface_map",
        "odl_inventory_nodes",
        "odl_inventory_nodes_operational"})
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping()
    for flow in utils.sort(get_all_flows(args, modules=['elan']), 'id'):
        host = compute_map.get(flow.get('dpnid'), flow.get('dpnid'))
        result = "MacHost:{}{}, Table:{}, FlowId:{}, {}, Flow:{}".format(
            flow['id'][-17:], host, flow['table'], flow['id'], utils.show_optionals(flow),
            utils.format_json(args, flow_parser.parse_flow(flow['flow'])))
        print(result)
コード例 #12
0
ファイル: flows.py プロジェクト: ww09/netvirt
def dump_flows(args, modules=None, sort_by='table', filter_by=None):
    modules = modules if modules else ['ifm']
    filter_by = filter_by if filter_by else []
    # odl_inventory_nodes_config = opendaylight_inventory.nodes(Model.CONFIG, args)
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping(
    )
    # neutron_neutron = neutron.neutron(Model.CONFIG, args)
    nports = config.gmodels.neutron_neutron.get_ports_by_key()
    for flow in utils.sort(get_all_flows(modules, filter_by), 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
        print 'Flow:', utils.format_json(args,
                                         flow_parser.parse_flow(flow['flow']))
コード例 #13
0
def dump_flows(args, modules=None, sort_by='table', filter_by=None):
    config.get_models(args,
                      {"neutron_neutron", "odl_inventory_nodes_operational"})

    modules = modules if modules else ['ifm']
    filter_by = filter_by if filter_by else []
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping(
    )
    nports = config.gmodels.neutron_neutron.get_ports_by_key()
    for flow in utils.sort(get_all_flows(args, modules, filter_by), 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)
        print("Flow: {}".format(
            utils.format_json(args, flow_parser.parse_flow(flow['flow']))))
コード例 #14
0
ファイル: flows.py プロジェクト: opendaylight/netvirt
def show_dup_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",
        # "mip_mac",
        "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"})
    mmac = {}  # config.gmodels.mip_mac.get_entries_by_key()
    einsts = config.gmodels.elan_elan_instances.get_clist_by_key()
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping()

    flows = utils.sort(get_all_flows(args, ['elan']), 'table')
    matches = collections.defaultdict(list)
    for flow in flows:
        dup_key = get_key_for_dup_detect(args, flow)
        if dup_key:
            if matches and matches.get(dup_key):
                matches[dup_key].append(flow)
            else:
                matches[dup_key].append(flow)
    for k, v in matches.iteritems():
        if len(v) > 1:
            dpnid = k.split(':')[0]
            host = compute_map.get(dpnid, dpnid)
            result = "Host:{}, FlowCount:{}, MatchKey:{}, ElanTag:{}".format(host, len(v), k, v[0].get('elan-tag'))
            print(result)
            for idx, flow in enumerate(v):
                result = "Duplicate"
                mac_addr = flow.get('dst-mac')
                if mac_addr and mmac.get(mac_addr):
                    result = is_correct_elan_flow(flow, mmac.get(mac_addr), einsts, host)
                print("    {} Flow-{}:{}".format(result, idx,
                                                 utils.format_json(args, flow_parser.parse_flow(flow.get('flow')))))
コード例 #15
0
ファイル: flows.py プロジェクト: opendaylight/netvirt
def dump_flows(args, modules=None, sort_by='table', filter_by=None):
    config.get_models(args, {
        "neutron_neutron",
        "odl_inventory_nodes_operational",
        "network_topology_network_topology_operational"})
    filter_by = filter_by if filter_by else []
    compute_map = config.gmodels.odl_inventory_nodes_operational.get_dpn_host_mapping()
    node_map = config.gmodels.network_topology_network_topology_operational.get_dpn_host_mapping()
    nports = config.gmodels.neutron_neutron.get_objects_by_key(obj=Neutron.PORTS)
    for flow in utils.sort(get_all_flows(args, modules, filter_by), sort_by):
        dpnid = flow.get('dpnid')
        host = compute_map.get(dpnid)
        if not host:
            host = node_map.get(int(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)
        if not args.metaonly:
            print("Flow: {}".format(utils.format_json(args, flow_parser.parse_flow(flow['flow']))))
コード例 #16
0
ファイル: analyze.py プロジェクト: zhangninglc/netvirt
def analyze_trunks(args):
    config.get_models(
        args,
        {
            "ietf_interfaces_interfaces",
            # "ietf_interfaces_interfaces_state",
            "l3vpn_vpn_interfaces",
            "neutron_neutron"
        })

    vpninterfaces = config.gmodels.l3vpn_vpn_interfaces.get_clist_by_key()
    ifaces = config.gmodels.ietf_interfaces_interfaces.get_clist_by_key()
    # ifstates = config.gmodels.ietf_interfaces_interfaces_state.get_clist_by_key()
    nports = config.gmodels.neutron_neutron.get_objects_by_key(
        obj=Neutron.PORTS)
    ntrunks = config.gmodels.neutron_neutron.get_trunks_by_key()
    subport_dict = {}
    for v in ntrunks.values():
        nport = nports.get(v.get('port-id'))
        s_subports = []
        for subport in v.get('sub-ports'):
            sport_id = subport.get('port-id')
            snport = nports.get(sport_id)
            svpniface = vpninterfaces.get(sport_id)
            siface = ifaces.get(sport_id)
            # sifstate = ifstates.get(sport_id)
            subport['SubNeutronPort'] = 'Correct' if snport else 'Wrong'
            subport['SubVpnInterface'] = 'Correct' if svpniface else 'Wrong'
            subport['ofport'] = Model.get_ofport_from_ncid()
            if siface:
                vlan_mode = siface.get('odl-interface:l2vlan-mode')
                parent_iface_id = siface.get('odl-interface:parent-interface')
                if vlan_mode != 'trunk-member':
                    subport['SubIface'] = 'WrongMode'
                elif parent_iface_id != v.get('port-id'):
                    subport['SubIface'] = 'WrongParent'
                elif siface.get('odl-interface:vlan-id') != subport.get(
                        'segmentation-id'):
                    subport['SubIface'] = 'WrongVlanId'
                else:
                    subport['SubIface'] = 'Correct'
            else:
                subport['SubIface'] = 'Wrong'
                # s_subport = 'SegId:{}, PortId:{}, SubNeutronPort:{}, SubIface:{}, SubVpnIface:{}'.format(
                #     subport.get('segmentation-id'), subport.get('port-id'),
                #     subport.get('SubNeutronPort'),
                #     subport.get('SubIface'),
                #     subport.get('SubVpnInterface'))
            s_subports.append(subport)
            subport_dict[subport['port-id']] = subport
            s_trunk = 'TrunkName:{}, TrunkId:{}, PortId:{}, NeutronPort:{}, SubPorts:{}'.format(
                v.get('name'), v.get('uuid'), v.get('port-id'),
                'Correct' if nport else 'Wrong',
                utils.format_json(args, s_subports))
            print(s_trunk)
            print("\n------------------------------------")
            print("Analyzing Flow status for SubPorts")
            print("------------------------------------")
            for flow in utils.sort(
                    flows.get_all_flows(args, ['ifm'], ['vlanid']), 'ifname'):
                subport = subport_dict.get(flow.get('ifname')) or None
                vlanid = subport.get('segmentation-id') if subport else None
                ofport = subport.get('ofport') if subport else None
                flow_status = 'Okay'
                if flow.get('ofport') and flow.get('ofport') != ofport:
                    flow_status = 'OfPort mismatch for SubPort:{} and Flow:{}'.format(
                        subport, flow.get('flow'))
                if flow.get('vlanid') and flow.get('vlanid') != vlanid:
                    flow_status = 'VlanId mismatch for SubPort:{} and Flow:{}'.format(
                        subport, flow.get('flow'))
                if subport:
                    print("SubPort:{},Table:{},FlowStatus:{}".format(
                        subport.get('port-id'), flow.get('table'),
                        flow_status))
コード例 #17
0
ファイル: analyze.py プロジェクト: opendaylight/netvirt
def analyze_trunks(args):
    config.get_models(args, {
        "ietf_interfaces_interfaces",
        # "ietf_interfaces_interfaces_state",
        "l3vpn_vpn_interfaces",
        "neutron_neutron"})

    vpninterfaces = config.gmodels.l3vpn_vpn_interfaces.get_clist_by_key()
    ifaces = config.gmodels.ietf_interfaces_interfaces.get_clist_by_key()
    # ifstates = config.gmodels.ietf_interfaces_interfaces_state.get_clist_by_key()
    nports = config.gmodels.neutron_neutron.get_objects_by_key(obj=Neutron.PORTS)
    ntrunks = config.gmodels.neutron_neutron.get_trunks_by_key()
    subport_dict = {}
    for v in ntrunks.values():
        nport = nports.get(v.get('port-id'))
        s_subports = []
        for subport in v.get('sub-ports'):
            sport_id = subport.get('port-id')
            snport = nports.get(sport_id)
            svpniface = vpninterfaces.get(sport_id)
            siface = ifaces.get(sport_id)
            # sifstate = ifstates.get(sport_id)
            subport['SubNeutronPort'] = 'Correct' if snport else 'Wrong'
            subport['SubVpnInterface'] = 'Correct' if svpniface else 'Wrong'
            subport['ofport'] = Model.get_ofport_from_ncid()
            if siface:
                vlan_mode = siface.get('odl-interface:l2vlan-mode')
                parent_iface_id = siface.get('odl-interface:parent-interface')
                if vlan_mode != 'trunk-member':
                    subport['SubIface'] = 'WrongMode'
                elif parent_iface_id != v.get('port-id'):
                    subport['SubIface'] = 'WrongParent'
                elif siface.get('odl-interface:vlan-id') != subport.get('segmentation-id'):
                    subport['SubIface'] = 'WrongVlanId'
                else:
                    subport['SubIface'] = 'Correct'
            else:
                subport['SubIface'] = 'Wrong'
                # s_subport = 'SegId:{}, PortId:{}, SubNeutronPort:{}, SubIface:{}, SubVpnIface:{}'.format(
                #     subport.get('segmentation-id'), subport.get('port-id'),
                #     subport.get('SubNeutronPort'),
                #     subport.get('SubIface'),
                #     subport.get('SubVpnInterface'))
            s_subports.append(subport)
            subport_dict[subport['port-id']] = subport
            s_trunk = 'TrunkName:{}, TrunkId:{}, PortId:{}, NeutronPort:{}, SubPorts:{}'.format(
                v.get('name'), v.get('uuid'), v.get('port-id'),
                'Correct' if nport else 'Wrong', utils.format_json(args, s_subports))
            print(s_trunk)
            print("\n------------------------------------")
            print("Analyzing Flow status for SubPorts")
            print("------------------------------------")
            for flow in utils.sort(flows.get_all_flows(args, ['ifm'], ['vlanid']), 'ifname'):
                subport = subport_dict.get(flow.get('ifname')) or None
                vlanid = subport.get('segmentation-id') if subport else None
                ofport = subport.get('ofport') if subport else None
                flow_status = 'Okay'
                if flow.get('ofport') and flow.get('ofport') != ofport:
                    flow_status = 'OfPort mismatch for SubPort:{} and Flow:{}'.format(subport, flow.get('flow'))
                if flow.get('vlanid') and flow.get('vlanid') != vlanid:
                    flow_status = 'VlanId mismatch for SubPort:{} and Flow:{}'.format(subport, flow.get('flow'))
                if subport:
                    print("SubPort:{},Table:{},FlowStatus:{}".format(
                        subport.get('port-id'), flow.get('table'), flow_status))