Search in sources :

Example 6 with Options

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options in project netvirt by opendaylight.

the class TestInterfaceManager method getTunnelPortsOnBridge.

@Override
public List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(BigInteger dpnId) {
    if (dpnId == GeniusProviderTestParams.DPN_ID_NO_EXIST) {
        // Unfortunately, the getTunnelPortsOnBridge() method may return null
        return null;
    }
    if (dpnId == GeniusProviderTestParams.DPN_ID_NO_PORTS) {
        return Collections.emptyList();
    }
    OvsdbTerminationPointAugmentationBuilder tpAug = new OvsdbTerminationPointAugmentationBuilder();
    tpAug.setOfport(GeniusProviderTestParams.OF_PORT);
    if (dpnId == GeniusProviderTestParams.DPN_ID_NO_VXGPE_PORTS) {
        // Tunnel Termination Point that is NOT of type VXGPE
        tpAug.setInterfaceType(InterfaceTypeGre.class);
    } else {
        // Tunnel Termination Point that IS of type VXGPE
        tpAug.setInterfaceType(InterfaceTypeVxlan.class);
    }
    List<Options> opsList = new ArrayList<>();
    if (dpnId != GeniusProviderTestParams.DPN_ID_NO_OPTIONS) {
        OptionsBuilder opsBuilder = new OptionsBuilder();
        opsBuilder.setKey(new OptionsKey(GeniusProvider.OPTION_KEY_EXTS));
        opsBuilder.setValue(GeniusProvider.OPTION_VALUE_EXTS_GPE);
        opsList.add(opsBuilder.build());
    }
    tpAug.setOptions(opsList);
    List<OvsdbTerminationPointAugmentation> tpAugList = new ArrayList<>();
    tpAugList.add(tpAug.build());
    return tpAugList;
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) ArrayList(java.util.ArrayList) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) OptionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder) OptionsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsKey)

Example 7 with Options

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options in project netvirt by opendaylight.

the class ShowFibCommand method doExecute.

@Override
protected Object doExecute() {
    PrintStream console = session.getConsole();
    if (prefixOrSubnetOption != null && prefixOrSubnetOption.length() > 0) {
        prefixOrSubnet = prefixOrSubnetOption.replace("[", "");
        prefixOrSubnet = prefixOrSubnet.replace("]", "");
        if (prefixOrSubnet.indexOf("/") < 0) {
            String maskFull = null;
            try {
                Inet4Address tempAdd = (Inet4Address) InetAddress.getByName(prefixOrSubnet);
                maskFull = "/32";
            } catch (SecurityException | UnknownHostException | ClassCastException e) {
                maskFull = null;
            }
            if (maskFull == null) {
                try {
                    Inet6Address tempAdd = (Inet6Address) InetAddress.getByName(prefixOrSubnet);
                    maskFull = "/128";
                } catch (SecurityException | UnknownHostException | ClassCastException e) {
                    maskFull = null;
                }
            }
            if (maskFull == null) {
                console.println("a part of cli " + SUBNET + " is wrong => " + prefixOrSubnet);
                return usage(console);
            }
            prefixOrSubnet += maskFull;
        }
    }
    console.println(HEADER);
    if (options == null && prefixOrSubnet == null && (addrFamList == null || addrFamList.isEmpty())) {
        InstanceIdentifier<FibEntries> id = InstanceIdentifier.create(FibEntries.class);
        try {
            FibEntries fibEntries = singleTxDb.syncRead(LogicalDatastoreType.CONFIGURATION, id);
            List<VrfTables> vrfTablesList = fibEntries.getVrfTables();
            if (vrfTablesList == null || vrfTablesList.isEmpty()) {
                console.println(" No Fib entries found");
                return null;
            }
            for (VrfTables vrfTable : vrfTablesList) {
                printVrfTable(vrfTable, console);
            }
        } catch (ExpectedDataObjectNotFoundException e404) {
            String errMsg = "FATAL: fib-entries container is missing from MD-SAL";
            console.println("\n" + errMsg);
            LOG.error(errMsg, e404);
        } catch (ReadFailedException rfe) {
            String errMsg = "Internal Error occurred while processing vpnservice:fib-show command";
            console.println("\n" + errMsg);
            LOG.error(errMsg, rfe);
        }
        return null;
    } else {
        String optionsLowerCase = options != null ? options.toLowerCase(Locale.getDefault()) : "";
        switch(optionsLowerCase) {
            case "fullhelp":
                return usage(console);
            default:
        }
        if ((addrFamList == null || addrFamList.isEmpty()) && (prefixOrSubnet == null || prefixOrSubnet.indexOf("/") < 5)) {
            console.println("any address family is requiered or " + SUBNET + " is wrong");
            usage(console);
        } else {
            boolean isIpv4 = false;
            boolean isIpv6 = false;
            boolean isL2vpn = false;
            if (addrFamList != null && addrFamList.size() > 0) {
                for (String addF : addrFamList) {
                    switch(addF.toLowerCase(Locale.getDefault())) {
                        case "ipv4":
                            isIpv4 = true;
                            break;
                        case "ipv6":
                            isIpv6 = true;
                            break;
                        case "l2vpn":
                            isL2vpn = true;
                            break;
                        default:
                    }
                }
            }
            InstanceIdentifier<FibEntries> id = InstanceIdentifier.create(FibEntries.class);
            try {
                FibEntries fibEntries = singleTxDb.syncRead(LogicalDatastoreType.CONFIGURATION, id);
                List<VrfTables> vrfTablesList = fibEntries.getVrfTables();
                if (vrfTablesList == null || vrfTablesList.isEmpty()) {
                    console.println(" No Fib entries found");
                    return null;
                }
                for (VrfTables vrfTable : vrfTablesList) {
                    printVrfTable(vrfTable, console, isIpv4, isIpv6, isL2vpn, prefixOrSubnet);
                }
            } catch (ExpectedDataObjectNotFoundException e404) {
                String errMsg = "FATAL: fib-entries container is missing from MD-SAL";
                console.println("\n" + errMsg);
                LOG.error(errMsg, e404);
            } catch (ReadFailedException rfe) {
                String errMsg = "Internal Error occurred while processing vpnservice:fib-show command";
                console.println("\n" + errMsg);
                LOG.error(errMsg, rfe);
            }
            return null;
        }
    }
    return null;
}
Also used : PrintStream(java.io.PrintStream) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Inet4Address(java.net.Inet4Address) UnknownHostException(java.net.UnknownHostException) ExpectedDataObjectNotFoundException(org.opendaylight.genius.datastoreutils.ExpectedDataObjectNotFoundException) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) Inet6Address(java.net.Inet6Address) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables)

Example 8 with Options

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options in project netvirt by opendaylight.

the class ShowSubnet method doExecute.

@Override
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
protected Object doExecute() throws Exception {
    if (subnetmap == null && subnetopdata == null && (options == null || options.isEmpty())) {
        getSubnet();
        System.out.println("Following subnetId is present in both subnetMap and subnetOpDataEntry\n");
        for (Subnetmap candidateSubnetmap : subnetmapList) {
            SubnetOpDataEntry data = subnetOpDataEntryMap.get(candidateSubnetmap.getId());
            if (data != null) {
                System.out.println(candidateSubnetmap.getId().toString() + "\n");
            }
        }
        System.out.println("\n\nFollowing subnetId is present in subnetMap but not in subnetOpDataEntry\n");
        for (Subnetmap candidateSubnetmap : subnetmapList) {
            SubnetOpDataEntry data = subnetOpDataEntryMap.get(candidateSubnetmap.getId());
            if (data == null) {
                System.out.println(candidateSubnetmap.getId().toString() + "\n");
            }
        }
        getshowVpnCLIHelp();
    } else if (subnetmap == null) {
        InstanceIdentifier<SubnetOpDataEntry> subOpIdentifier = InstanceIdentifier.builder(SubnetOpData.class).child(SubnetOpDataEntry.class, new SubnetOpDataEntryKey(new Uuid(subnetopdata))).build();
        Optional<SubnetOpDataEntry> optionalSubs = syncReadOptional(dataBroker, OPERATIONAL, subOpIdentifier);
        SubnetOpDataEntry data = optionalSubs.get();
        System.out.println("Fetching subnetmap for given subnetId\n");
        System.out.println("------------------------------------------------------------------------------");
        System.out.println("Key: " + data.getKey() + "\n" + "VrfId: " + data.getVrfId() + "\n" + "ElanTag: " + "" + data.getElanTag() + "\n" + "NhDpnId: " + data.getNhDpnId() + "\n" + "RouteAdvState: " + data.getRouteAdvState() + "\n" + "SubnetCidr: " + data.getSubnetCidr() + "\n" + "SubnetToDpnList: " + data.getSubnetToDpn() + "\n" + "VpnName: " + data.getVpnName() + "\n");
        System.out.println("------------------------------------------------------------------------------");
    }
    if (subnetmap == null && subnetopdata != null) {
        InstanceIdentifier<SubnetOpDataEntry> subOpIdentifier = InstanceIdentifier.builder(SubnetOpData.class).child(SubnetOpDataEntry.class).build();
        Optional<SubnetOpDataEntry> optionalSubnetOpDataEntries = syncReadOptional(dataBroker, OPERATIONAL, subOpIdentifier);
        if (optionalSubnetOpDataEntries.isPresent()) {
            optionalSubnetOpDataEntries.asSet().forEach(subnetOpDataEntry -> {
                SubnetOpDataEntry data = subnetOpDataEntry;
                System.out.println("Fetching subnetmapdataentry for given subnetId\n");
                System.out.println("------------------------" + "------------------------------------------------------");
                System.out.println("Key: " + data.getKey() + "\n" + "VrfId: " + data.getVrfId() + "\n" + "ElanTag: " + "" + data.getElanTag() + "\n" + "NhDpnId: " + data.getNhDpnId() + "\n" + "RouteAdvState: " + data.getRouteAdvState() + "\n" + "SubnetCidr: " + data.getSubnetCidr() + "\n" + "SubnetToDpnList: " + data.getSubnetToDpn() + "\n" + "VpnName: " + data.getVpnName() + "\n");
                System.out.println("------------------------" + "------------------------------------------------------");
            });
        }
    }
    if (subnetmap != null && subnetopdata == null) {
        InstanceIdentifier<Subnetmap> id = InstanceIdentifier.builder(Subnetmaps.class).child(Subnetmap.class, new SubnetmapKey(new Uuid(subnetmap))).build();
        Optional<Subnetmap> sn = syncReadOptional(dataBroker, CONFIGURATION, id);
        Subnetmap data = sn.get();
        System.out.println("Fetching subnetopdata for given subnetId\n");
        System.out.println("------------------------------------------------------------------------------");
        String getRouterInterfacePortId = (data.getRouterInterfacePortId() != null ? data.getRouterInterfacePortId().getValue() : "null");
        System.out.println("Key: " + data.getKey() + "\n" + "VpnId: " + data.getVpnId() + "\n" + "InternetVpnId: " + data.getInternetVpnId() + "\n" + "DirectPortList: " + data.getDirectPortList() + "\n" + "NetworkId: " + data.getNetworkId() + "\n" + "Network-type: " + data.getNetworkType() + "\n" + "Network-segmentation-Id: " + data.getSegmentationId() + "\n" + "PortList: " + data.getPortList() + "\n" + "RouterInterfaceFixedIp: " + data.getRouterInterfaceFixedIp() + "\n" + "RouterInterfacePortId: " + getRouterInterfacePortId + "\n" + "RouterIntfMacAddress: " + data.getRouterIntfMacAddress() + "\n" + "SubnetIp: " + data.getSubnetIp() + "\n" + "TenantId: " + data.getTenantId() + "\n");
        System.out.println("------------------------------------------------------------------------------");
    } else if (subnetopdata == null) {
        InstanceIdentifier<Subnetmap> id = InstanceIdentifier.builder(Subnetmaps.class).child(Subnetmap.class, new SubnetmapKey(new Uuid(subnetmap))).build();
        Optional<Subnetmap> sn = syncReadOptional(dataBroker, CONFIGURATION, id);
        Subnetmap data = sn.get();
        System.out.println("Fetching subnetopdata for given subnetId\n");
        System.out.println("------------------------------------------------------------------------------");
        String getRouterInterfacePortId = (data.getRouterInterfacePortId() != null ? data.getRouterInterfacePortId().getValue() : "null");
        System.out.println("Key: " + data.getKey() + "\n" + "VpnId: " + data.getVpnId() + "\n" + "InternetVpnId: " + data.getInternetVpnId() + "\n" + "DirectPortList: " + data.getDirectPortList() + "\n" + "NetworkId: " + data.getNetworkId() + "\n" + "Network-type: " + data.getNetworkType() + "\n" + "Network-segmentation-Id: " + data.getSegmentationId() + "\n" + "PortList: " + data.getPortList() + "\n" + "RouterInterfaceFixedIp: " + data.getRouterInterfaceFixedIp() + "\n" + "RouterInterfacePortId: " + getRouterInterfacePortId + "\n" + "RouterIntfMacAddress: " + data.getRouterIntfMacAddress() + "\n" + "SubnetIp: " + data.getSubnetIp() + "\n" + "TenantId: " + data.getTenantId() + "\n");
        System.out.println("------------------------------------------------------------------------------");
    } else {
        InstanceIdentifier<SubnetOpDataEntry> subOpIdentifier = InstanceIdentifier.builder(SubnetOpData.class).child(SubnetOpDataEntry.class, new SubnetOpDataEntryKey(new Uuid(subnetopdata))).build();
        Optional<SubnetOpDataEntry> optionalSubs = syncReadOptional(dataBroker, OPERATIONAL, subOpIdentifier);
        SubnetOpDataEntry data = optionalSubs.get();
        System.out.println("Fetching subnetmap for given subnetId\n");
        System.out.println("------------------------------------------------------------------------------");
        System.out.println("Key: " + data.getKey() + "\n" + "VrfId: " + data.getVrfId() + "\n" + "ElanTag: " + "" + data.getElanTag() + "\n" + "NhDpnId: " + data.getNhDpnId() + "\n" + "RouteAdvState: " + data.getRouteAdvState() + "\n" + "SubnetCidr: " + data.getSubnetCidr() + "\n" + "SubnetToDpnList: " + data.getSubnetToDpn() + "\n" + "VpnName: " + data.getVpnName() + "\n");
        System.out.println("------------------------------------------------------------------------------");
    }
    Boolean optionsSubnetopdataall = false;
    Boolean optionsSubnetmapall = false;
    if (options != null && !options.isEmpty()) {
        for (String opt : options) {
            String optLowCase = opt == null ? "" : opt.toLowerCase(Locale.ENGLISH);
            if (optLowCase.startsWith("subnetop")) {
                optionsSubnetopdataall = true;
            }
            if (optLowCase.startsWith("subnetmap")) {
                optionsSubnetmapall = true;
            }
        }
    }
    if (optionsSubnetopdataall) {
        InstanceIdentifier<SubnetOpData> subOpIdentifier = InstanceIdentifier.builder(SubnetOpData.class).build();
        Optional<SubnetOpData> optionalSubnetOpData = syncReadOptional(dataBroker, OPERATIONAL, subOpIdentifier);
        if (optionalSubnetOpData.isPresent()) {
            List<SubnetOpDataEntry> subnetOpDataEntryList = optionalSubnetOpData.get().getSubnetOpDataEntry();
            System.out.println("number of subnetOpDataEntry found are : " + subnetOpDataEntryList + "\n");
            subnetOpDataEntryList.forEach(subnetOpDataEntry -> {
                SubnetOpDataEntry data = subnetOpDataEntry;
                System.out.println("Fetching subnetmap for given subnetId\n");
                System.out.println("------------------------" + "------------------------------------------------------");
                System.out.println("Key: " + data.getKey() + "\n" + "VrfId: " + data.getVrfId() + "\n" + "ElanTag: " + "" + data.getElanTag() + "\n" + "NhDpnId: " + data.getNhDpnId() + "\n" + "RouteAdvState: " + data.getRouteAdvState() + "\n" + "SubnetCidr: " + data.getSubnetCidr() + "\n" + "SubnetToDpnList: " + data.getSubnetToDpn() + "\n" + "VpnName: " + data.getVpnName() + "\n");
                System.out.println("------------------------" + "------------------------------------------------------");
            });
        } else {
            System.out.println("No SubnetOpDataEntry present in Oper DS");
        }
    }
    if (optionsSubnetmapall) {
        InstanceIdentifier<Subnetmaps> subMapIdentifier = InstanceIdentifier.builder(Subnetmaps.class).build();
        Optional<Subnetmaps> optionalSubnetmaps = syncReadOptional(dataBroker, CONFIGURATION, subMapIdentifier);
        if (optionalSubnetmaps.isPresent()) {
            List<Subnetmap> subnetMapList = optionalSubnetmaps.get().getSubnetmap();
            System.out.println("number of subnetmaps found are : " + subnetMapList.size() + "\n");
            subnetMapList.forEach(sn -> {
                if (sn != null) {
                    System.out.println("Fetching subnetmap for given subnetId\n");
                    System.out.println("------------------------" + "------------------------------------------------------");
                    System.out.println("Uuid: " + sn.getId() + "\n" + "SubnetIp: " + sn.getSubnetIp() + "\n" + "NetworkId: " + sn.getNetworkId() + "\n" + "NetworkType: " + sn.getNetworkType() + "\nSegmentationId: " + sn.getSegmentationId() + "\n" + "TenantId: " + sn.getTenantId() + "\n" + "RouterId: " + sn.getRouterId() + "\n" + "RouterInterfacePortId: " + sn.getRouterInterfacePortId() + "\nRouterIntfMacAddress: " + sn.getRouterIntfMacAddress() + "\n" + "RouterInterfaceFixedIp: " + sn.getRouterInterfaceFixedIp() + "\n" + "VpnId: " + sn.getVpnId() + "\n" + "InternetVpnId: " + sn.getInternetVpnId() + "\n");
                    if (sn.getPortList() != null) {
                        System.out.println("There are " + sn.getPortList().size() + " port in the port-list");
                        for (int i = 0; i < sn.getPortList().size(); i++) {
                            System.out.println("\tport num " + i + " :\t" + sn.getPortList().get(i));
                        }
                    }
                    if (sn.getDirectPortList() != null) {
                        System.out.println("There are " + sn.getDirectPortList().size() + " port in the list of direct-port");
                        for (int i = 0; i < sn.getDirectPortList().size(); i++) {
                            System.out.println("\tdirect port num " + i + " :\t" + sn.getDirectPortList().get(i));
                        }
                    }
                    System.out.println("------------------------" + "------------------------------------------------------");
                }
            });
        } else {
            System.out.println("No Subnetmap present in Config DS");
        }
    }
    getshowVpnCLIHelp();
    return null;
}
Also used : Optional(com.google.common.base.Optional) SingleTransactionDataBroker.syncReadOptional(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker.syncReadOptional) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap) SubnetOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntry) SubnetOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.SubnetOpData) Subnetmaps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.Subnetmaps) SubnetOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryKey) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) SubnetmapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.SubnetmapKey) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier)

Example 9 with Options

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options in project netvirt by opendaylight.

the class GeniusProvider method getEgressVxlanPortForNode.

public Optional<Long> getEgressVxlanPortForNode(BigInteger dpnId) {
    List<OvsdbTerminationPointAugmentation> tpList = interfaceMgr.getTunnelPortsOnBridge(dpnId);
    if (tpList == null) {
        // Most likely the bridge doesnt exist for this dpnId
        LOG.warn("getEgressVxlanPortForNode Tunnel Port TerminationPoint list not available for dpnId [{}]", dpnId);
        return Optional.empty();
    }
    for (OvsdbTerminationPointAugmentation tp : tpList) {
        if (tp == null) {
            // Technically we should never have a list with NULL entries, but
            // in a preliminary version of interfaceMgr.getTunnelPortsOnBridge()
            // we were getting a list where all termination point entries were
            // null. Leaving this check for now for protection.
            LOG.error("getEgressVxlanPortForNode received a NULL termination point from tpList on dpnId [{}]", dpnId);
            continue;
        }
        Class<? extends InterfaceTypeBase> ifType = tp.getInterfaceType();
        if (ifType.equals(InterfaceTypeVxlan.class)) {
            List<Options> tpOptions = tp.getOptions();
            for (Options tpOption : tpOptions) {
                // From the VXLAN Tunnels, we want the one with the GPE option set
                if (tpOption.getKey().getOption().equals(OPTION_KEY_EXTS)) {
                    if (tpOption.getValue().equals(OPTION_VALUE_EXTS_GPE)) {
                        return Optional.ofNullable(tp.getOfport());
                    }
                }
            }
        }
    }
    LOG.warn("getEgressVxlanPortForNode no Vxgpe tunnel ports available for dpnId [{}]", dpnId);
    return Optional.empty();
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)

Example 10 with Options

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options in project genius by opendaylight.

the class SouthboundUtils method addTerminationPoint.

private void addTerminationPoint(InstanceIdentifier<?> bridgeIid, String portName, int vlanId, Class<? extends InterfaceTypeBase> type, Map<String, String> options, IfTunnel ifTunnel) {
    OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
    tpAugmentationBuilder.setName(portName);
    if (type != null) {
        tpAugmentationBuilder.setInterfaceType(type);
    }
    if (options != null) {
        List<Options> optionsList = new ArrayList<>();
        for (Map.Entry<String, String> entry : options.entrySet()) {
            OptionsBuilder optionsBuilder = new OptionsBuilder();
            optionsBuilder.setKey(new OptionsKey(entry.getKey()));
            optionsBuilder.setOption(entry.getKey());
            optionsBuilder.setValue(entry.getValue());
            optionsList.add(optionsBuilder.build());
        }
        tpAugmentationBuilder.setOptions(optionsList);
    }
    if (vlanId != 0) {
        tpAugmentationBuilder.setVlanMode(OvsdbPortInterfaceAttributes.VlanMode.Access);
        tpAugmentationBuilder.setVlanTag(new VlanId(vlanId));
    }
    if (bfdMonitoringEnabled(ifTunnel)) {
        if (isOfTunnel(ifTunnel)) {
            LOG.warn("BFD Monitoring not supported for OFTunnels");
        } else {
            List<InterfaceBfd> bfdParams = getBfdParams(ifTunnel);
            tpAugmentationBuilder.setInterfaceBfd(bfdParams);
        }
    }
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    InstanceIdentifier<TerminationPoint> tpIid = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), portName);
    tpBuilder.setKey(InstanceIdentifier.keyOf(tpIid));
    tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
    batchingUtils.write(tpIid, tpBuilder.build(), BatchingUtils.EntityType.TOPOLOGY_CONFIG);
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) TunnelOptions(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions) ArrayList(java.util.ArrayList) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) OptionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) InterfaceBfd(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd) Map(java.util.Map) HashMap(java.util.HashMap) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) OptionsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsKey)

Aggregations

ArrayList (java.util.ArrayList)5 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)4 Options (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options)4 List (java.util.List)3 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)3 Optional (com.google.common.base.Optional)2 Collectors (java.util.stream.Collectors)2 StringUtils (org.apache.commons.lang3.StringUtils)2 RouteEntryBaseAttributes (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes)2 BgpActionPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionPolicy)2 BGPRouteEntryExportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters)2 BGPRouteEntryImportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters)2 BgpSetCommunityOptionType (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.BgpSetCommunityOptionType)2 TunnelOptions (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions)2 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)2 Communities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.Communities)2 ExtendedCommunities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunities)2 OvsdbTerminationPointAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)2 OvsdbTerminationPointAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder)2 OptionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder)2