Search in sources :

Example 41 with Order

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order in project netvirt by opendaylight.

the class OpenFlow13Utils method createActionNxPushNsh.

public static Action createActionNxPushNsh(int order) {
    NxPushNshBuilder builder = new NxPushNshBuilder();
    NxPushNsh nxPushNsh = builder.build();
    ActionBuilder ab = createActionBuilder(order);
    ab.setAction(new NxActionPushNshNodesNodeTableFlowApplyActionsCaseBuilder().setNxPushNsh(nxPushNsh).build());
    return ab.build();
}
Also used : OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) NxActionPushNshNodesNodeTableFlowApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPushNshNodesNodeTableFlowApplyActionsCaseBuilder) NxPushNsh(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.push.nsh.grouping.NxPushNsh) NxPushNshBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.push.nsh.grouping.NxPushNshBuilder)

Example 42 with Order

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order in project netvirt by opendaylight.

the class OpenFlow13Utils method createActionNxLoadNsp.

public static Action createActionNxLoadNsp(int value, int order) {
    ActionBuilder ab = createActionBuilder(order);
    ab.setAction(nxLoadRegAction(new DstNxNspCaseBuilder().setNxNspDst(Boolean.TRUE).build(), BigInteger.valueOf(value), 23, false));
    return ab.build();
}
Also used : OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) DstNxNspCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNspCaseBuilder)

Example 43 with Order

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order in project netvirt by opendaylight.

the class PortChainTranslator method buildServiceFunctionChain.

public static ServiceFunctionChain buildServiceFunctionChain(PortChain portChain, List<ServiceFunction> sfList) {
    ServiceFunctionChainBuilder sfcBuilder = new ServiceFunctionChainBuilder();
    sfcBuilder.setName(new SfcName(portChain.getName()));
    sfcBuilder.setKey(new ServiceFunctionChainKey(sfcBuilder.getName()));
    // By default set it to false. If user specify it in chain parameters, it
    // will be overridden.
    sfcBuilder.setSymmetric(false);
    // Set service functions
    List<SfcServiceFunction> sfcSfList = new ArrayList<>();
    for (ServiceFunction sf : sfList) {
        SfcServiceFunctionBuilder sfcSfBuilder = new SfcServiceFunctionBuilder();
        sfcSfBuilder.setName(sf.getName().getValue());
        sfcSfBuilder.setType(sf.getType());
        sfcSfBuilder.setKey(new SfcServiceFunctionKey(sfcSfBuilder.getName()));
        // NOTE: no explicit order is set.
        sfcSfList.add(sfcSfBuilder.build());
    }
    List<ChainParameters> cpList = portChain.getChainParameters();
    if (cpList != null && !cpList.isEmpty()) {
        for (ChainParameters cp : cpList) {
            if (cp.getChainParameter().equals(SYMMETRIC_PARAM)) {
                // Override the symmetric default value.
                sfcBuilder.setSymmetric(Boolean.valueOf(cp.getChainParameterValue()));
                break;
            }
        }
    }
    sfcBuilder.setSfcServiceFunction(sfcSfList);
    return sfcBuilder.build();
}
Also used : SfcName(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfcName) SfcServiceFunctionBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.service.function.chain.SfcServiceFunctionBuilder) SfcServiceFunction(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.service.function.chain.SfcServiceFunction) ServiceFunction(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction) ServiceFunctionChainBuilder(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.ServiceFunctionChainBuilder) ArrayList(java.util.ArrayList) ChainParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.port.chain.attributes.ChainParameters) SfcServiceFunction(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.service.function.chain.SfcServiceFunction) ServiceFunctionChainKey(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.ServiceFunctionChainKey) SfcServiceFunctionKey(org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.service.function.chain.SfcServiceFunctionKey)

Example 44 with Order

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order in project netvirt by opendaylight.

the class Ipv6ServiceUtils method getIpv6SolicitedNodeMcastAddress.

public static Ipv6Address getIpv6SolicitedNodeMcastAddress(Ipv6Address ipv6Address) {
    /* According to RFC 4291, a Solicited Node Multicast Address is derived by adding the 24
           lower order bits with the Solicited Node multicast prefix (i.e., FF02::1:FF00:0/104).
           Example: For IPv6Address of FE80::2AA:FF:FE28:9C5A, the corresponding solicited node
           multicast address would be FF02::1:FF28:9C5A
         */
    byte[] octets;
    try {
        octets = InetAddress.getByName(ipv6Address.getValue()).getAddress();
    } catch (UnknownHostException e) {
        LOG.error("getIpv6SolicitedNodeMcastAddress: Failed to serialize ipv6Address ", e);
        return null;
    }
    // Return the address in its fully expanded format.
    Ipv6Address solictedV6Address = new Ipv6Address(InetAddresses.forString("ff02::1:ff" + StringUtils.leftPad(Integer.toHexString(0xFF & octets[13]), 2, "0") + ":" + StringUtils.leftPad(Integer.toHexString(0xFF & octets[14]), 2, "0") + StringUtils.leftPad(Integer.toHexString(0xFF & octets[15]), 2, "0")).getHostAddress());
    return solictedV6Address;
}
Also used : UnknownHostException(java.net.UnknownHostException) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)

Example 45 with Order

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order in project netvirt by opendaylight.

the class NeutronPortChangeListener method update.

@Override
protected void update(InstanceIdentifier<Port> identifier, Port original, Port update) {
    // in order to validate the supported vnic types from the hostconfig
    if (isPortTypeSwitchdev(original) && !isPortBound(original) && isPortBound(update)) {
        handleNeutronPortCreated(update);
    }
    final String portName = update.getUuid().getValue();
    Network network = neutronvpnUtils.getNeutronNetwork(update.getNetworkId());
    LOG.info("Update port {} from network {}", portName, update.getNetworkId().toString());
    if (network == null || !NeutronvpnUtils.isNetworkTypeSupported(network)) {
        LOG.error("neutron vpn received a port update() for a network without a provider extension augmentation " + "or with an unsupported network type for the port {} which is part of network {}", portName, network);
        return;
    }
    neutronvpnUtils.addToPortCache(update);
    if ((Strings.isNullOrEmpty(original.getDeviceOwner()) || Strings.isNullOrEmpty(original.getDeviceId()) || NeutronConstants.FLOATING_IP_DEVICE_ID_PENDING.equalsIgnoreCase(original.getDeviceId())) && !Strings.isNullOrEmpty(update.getDeviceOwner()) && !Strings.isNullOrEmpty(update.getDeviceId())) {
        if (update.getDeviceOwner().equals(NeutronConstants.DEVICE_OWNER_ROUTER_INF)) {
            handleRouterInterfaceAdded(update);
            return;
        }
        if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(update.getDeviceOwner())) {
            handleRouterGatewayUpdated(update);
        } else if (NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(update.getDeviceOwner())) {
            handleFloatingIpPortUpdated(original, update);
        }
    } else {
        Set<FixedIps> oldIPs = getFixedIpSet(original.getFixedIps());
        Set<FixedIps> newIPs = getFixedIpSet(update.getFixedIps());
        if (!oldIPs.equals(newIPs)) {
            handleNeutronPortUpdated(original, update);
        }
    }
    // check if port security enabled/disabled as part of port update
    boolean origSecurityEnabled = NeutronvpnUtils.getPortSecurityEnabled(original);
    boolean updatedSecurityEnabled = NeutronvpnUtils.getPortSecurityEnabled(update);
    if (origSecurityEnabled || updatedSecurityEnabled) {
        InstanceIdentifier<Interface> interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(portName);
        jobCoordinator.enqueueJob("PORT- " + portName, () -> {
            WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
            try {
                Optional<Interface> optionalInf = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, interfaceIdentifier);
                if (optionalInf.isPresent()) {
                    InterfaceBuilder interfaceBuilder = new InterfaceBuilder(optionalInf.get());
                    InterfaceAcl infAcl = handlePortSecurityUpdated(original, update, origSecurityEnabled, updatedSecurityEnabled, interfaceBuilder).build();
                    interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
                    LOG.info("update: Of-port-interface updation for port {}", portName);
                    // Update OFPort interface for this neutron port
                    wrtConfigTxn.put(LogicalDatastoreType.CONFIGURATION, interfaceIdentifier, interfaceBuilder.build());
                } else {
                    LOG.warn("update: Interface {} is not present", portName);
                }
            } catch (ReadFailedException e) {
                LOG.error("update: Failed to update interface {}", portName, e);
            }
            List<ListenableFuture<Void>> futures = new ArrayList<>();
            futures.add(wrtConfigTxn.submit());
            return futures;
        });
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) ArrayList(java.util.ArrayList) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) InterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder) InterfaceAcl(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)

Aggregations

ArrayList (java.util.ArrayList)22 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)19 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)17 VisibleForTesting (com.google.common.annotations.VisibleForTesting)7 Batch (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch)6 BatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.BatchBuilder)6 Test (org.junit.Test)5 ItemSyncBox (org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox)5 LinkedHashMap (java.util.LinkedHashMap)4 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)3 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)3 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)3 ByteBuf (io.netty.buffer.ByteBuf)2 BigInteger (java.math.BigInteger)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 L2vlan (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan)2