Search in sources :

Example 1 with SffDataPlaneLocatorBuilder

use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorBuilder in project netvirt by opendaylight.

the class PortPairGroupTranslator method buildServiceFunctionForwarder.

public static ServiceFunctionForwarder buildServiceFunctionForwarder(PortPairGroup portPairGroup, List<PortPair> portPairs) {
    Preconditions.checkNotNull(portPairGroup, "Port pair group must not be null");
    Preconditions.checkNotNull(portPairs, "Port pairs must not be null");
    Preconditions.checkElementIndex(0, portPairs.size(), "There must be at least one port pair");
    // Currently we only support one SF per type. Mean, one port-pair per port-pair-group.
    final PortPair portPair = portPairs.get(0);
    ServiceFunctionForwarderBuilder sffBuilder = new ServiceFunctionForwarderBuilder();
    sffBuilder.setName(new SffName(SfcMdsalHelper.NETVIRT_LOGICAL_SFF_NAME));
    DataPlaneLocatorBuilder forwardDplBuilder = new DataPlaneLocatorBuilder();
    forwardDplBuilder.setTransport(Mac.class);
    String forwardPort = portPair.getIngress().getValue();
    LogicalInterface forwardInterface = new LogicalInterfaceBuilder().setInterfaceName(forwardPort).build();
    forwardDplBuilder.setLocatorType(forwardInterface);
    SffDataPlaneLocatorBuilder sffForwardDplBuilder = new SffDataPlaneLocatorBuilder();
    sffForwardDplBuilder.setDataPlaneLocator(forwardDplBuilder.build());
    String forwardDplName = portPair.getName() + DPL_INGRESS_SUFFIX;
    sffForwardDplBuilder.setName(new SffDataPlaneLocatorName(forwardDplName));
    DataPlaneLocatorBuilder reverseDplBuilder = new DataPlaneLocatorBuilder();
    reverseDplBuilder.setTransport(Mac.class);
    String reversePort = portPair.getEgress().getValue();
    LogicalInterface reverseInterface = new LogicalInterfaceBuilder().setInterfaceName(reversePort).build();
    reverseDplBuilder.setLocatorType(reverseInterface);
    SffDataPlaneLocatorBuilder sffReverseDplBuilder = new SffDataPlaneLocatorBuilder();
    sffReverseDplBuilder.setDataPlaneLocator(reverseDplBuilder.build());
    String reverseDplName = portPair.getName() + DPL_EGRESS_SUFFIX;
    sffReverseDplBuilder.setName(new SffDataPlaneLocatorName(reverseDplName));
    List<SffDataPlaneLocator> sffDataPlaneLocator = new ArrayList<>();
    sffDataPlaneLocator.add(sffForwardDplBuilder.build());
    sffDataPlaneLocator.add(sffReverseDplBuilder.build());
    sffBuilder.setSffDataPlaneLocator(sffDataPlaneLocator);
    SffSfDataPlaneLocatorBuilder sffSfDataPlaneLocatorBuilder = new SffSfDataPlaneLocatorBuilder();
    sffSfDataPlaneLocatorBuilder.setSffForwardDplName(new SffDataPlaneLocatorName(forwardDplName));
    sffSfDataPlaneLocatorBuilder.setSfForwardDplName(new SfDataPlaneLocatorName(forwardDplName));
    sffSfDataPlaneLocatorBuilder.setSffReverseDplName(new SffDataPlaneLocatorName(reverseDplName));
    sffSfDataPlaneLocatorBuilder.setSfReverseDplName(new SfDataPlaneLocatorName(reverseDplName));
    ServiceFunctionDictionaryBuilder sfdBuilder = new ServiceFunctionDictionaryBuilder();
    sfdBuilder.setName(new SfName(portPair.getName()));
    sfdBuilder.setSffSfDataPlaneLocator(sffSfDataPlaneLocatorBuilder.build());
    List<ServiceFunctionDictionary> sfdList = new ArrayList<>();
    sfdList.add(sfdBuilder.build());
    sffBuilder.setServiceFunctionDictionary(sfdList);
    return sffBuilder.build();
}
Also used : SffSfDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder) DataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.sff.data.plane.locator.DataPlaneLocatorBuilder) SffDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorBuilder) ServiceFunctionForwarderBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder) ArrayList(java.util.ArrayList) SffName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SffName) SffDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorBuilder) SffDataPlaneLocatorName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SffDataPlaneLocatorName) SfDataPlaneLocatorName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfDataPlaneLocatorName) LogicalInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.sfc.sff.logical.rev160620.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.data.plane.locator.locator.type.LogicalInterfaceBuilder) LogicalInterface(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.sfc.sff.logical.rev160620.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.data.plane.locator.locator.type.LogicalInterface) PortPair(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pairs.PortPair) SffSfDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder) SfName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfName) ServiceFunctionDictionary(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary) SffDataPlaneLocator(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocator) ServiceFunctionDictionaryBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder)

Example 2 with SffDataPlaneLocatorBuilder

use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorBuilder in project netvirt by opendaylight.

the class SfcProviderTest method createRsp.

private RenderedServicePathBuilder createRsp(RspName rspName, boolean hasHops, boolean hasSfName, boolean hasSffName, boolean hasDict, boolean hasSfDict, boolean createSff, boolean createSffDpl, boolean createLogicalSfDpl) {
    RenderedServicePathBuilder rspBuilder = createRsp(rspName);
    SffName sffName = new SffName(SFF_NAME);
    SfName sfName = new SfName(SF_NAME);
    RenderedServicePathHopBuilder rspHopBuilder = new RenderedServicePathHopBuilder();
    if (hasSfName) {
        rspHopBuilder.setServiceFunctionName(sfName);
    }
    if (hasSffName) {
        rspHopBuilder.setServiceFunctionForwarder(sffName);
    }
    if (hasHops) {
        List<RenderedServicePathHop> hops = new ArrayList<>();
        hops.add(rspHopBuilder.build());
        rspBuilder.setRenderedServicePathHop(hops);
    }
    ServiceFunctionForwarderBuilder sffBuilder = new ServiceFunctionForwarderBuilder();
    ServiceFunctionDictionaryBuilder serviceFunctionDictionaryBuilder = new ServiceFunctionDictionaryBuilder();
    serviceFunctionDictionaryBuilder.setName(sfName);
    if (hasSfDict) {
        SffSfDataPlaneLocatorBuilder sffSfDataPlaneLocatorBuilder = new SffSfDataPlaneLocatorBuilder();
        sffSfDataPlaneLocatorBuilder.setSffDplName(new SffDataPlaneLocatorName(SFF_DPL_NAME));
        serviceFunctionDictionaryBuilder.setSffSfDataPlaneLocator(sffSfDataPlaneLocatorBuilder.build());
    }
    if (hasDict) {
        sffBuilder.setServiceFunctionDictionary(Collections.singletonList(serviceFunctionDictionaryBuilder.build()));
    }
    SffDataPlaneLocatorBuilder sffDplBuilder = new SffDataPlaneLocatorBuilder();
    DataPlaneLocatorBuilder dataPlaneLocatorBuilder = new DataPlaneLocatorBuilder();
    if (createLogicalSfDpl) {
        LogicalInterfaceBuilder liBuilder = new LogicalInterfaceBuilder();
        liBuilder.setInterfaceName(LOGICAL_IF_NAME);
        dataPlaneLocatorBuilder.setLocatorType(liBuilder.build());
        sffDplBuilder.setDataPlaneLocator(dataPlaneLocatorBuilder.build());
    }
    if (createSffDpl) {
        List<SffDataPlaneLocator> sffDpls = new ArrayList<>();
        sffDplBuilder.setKey(new SffDataPlaneLocatorKey(new SffDataPlaneLocatorName(SFF_DPL_NAME)));
        sffDplBuilder.setName(new SffDataPlaneLocatorName(SFF_DPL_NAME));
        sffDpls.add(sffDplBuilder.build());
        sffBuilder.setSffDataPlaneLocator(sffDpls);
    }
    if (createSff) {
        sffBuilder.setName(sffName);
        storeSff(sffName, sffBuilder.build());
    }
    return rspBuilder;
}
Also used : SffSfDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder) DataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.sff.data.plane.locator.DataPlaneLocatorBuilder) SffDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorBuilder) ServiceFunctionForwarderBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder) ArrayList(java.util.ArrayList) SffName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SffName) RenderedServicePathHopBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.rendered.service.path.RenderedServicePathHopBuilder) SffDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorBuilder) RenderedServicePathHop(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.rendered.service.path.RenderedServicePathHop) SffDataPlaneLocatorName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SffDataPlaneLocatorName) RenderedServicePathBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePathBuilder) LogicalInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.sfc.sff.logical.rev160620.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.data.plane.locator.locator.type.LogicalInterfaceBuilder) SffSfDataPlaneLocatorBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder) SfName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfName) SffDataPlaneLocatorKey(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorKey) ServiceFunctionDictionaryBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder) SffDataPlaneLocator(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocator)

Aggregations

ArrayList (java.util.ArrayList)2 SfName (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfName)2 SffDataPlaneLocatorName (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SffDataPlaneLocatorName)2 SffName (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SffName)2 SffDataPlaneLocator (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocator)2 SffDataPlaneLocatorBuilder (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorBuilder)2 DataPlaneLocatorBuilder (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.sff.data.plane.locator.DataPlaneLocatorBuilder)2 ServiceFunctionForwarderBuilder (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder)2 ServiceFunctionDictionaryBuilder (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder)2 SffSfDataPlaneLocatorBuilder (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder)2 LogicalInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.sfc.sff.logical.rev160620.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.data.plane.locator.locator.type.LogicalInterfaceBuilder)2 SfDataPlaneLocatorName (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfDataPlaneLocatorName)1 RenderedServicePathBuilder (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePathBuilder)1 RenderedServicePathHop (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.rendered.service.path.RenderedServicePathHop)1 RenderedServicePathHopBuilder (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.rendered.service.path.RenderedServicePathHopBuilder)1 SffDataPlaneLocatorKey (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarder.base.SffDataPlaneLocatorKey)1 ServiceFunctionDictionary (org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary)1 LogicalInterface (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.sfc.sff.logical.rev160620.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.data.plane.locator.locator.type.LogicalInterface)1 PortPair (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pairs.PortPair)1