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();
}
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();
}
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();
}
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;
}
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;
});
}
}
Aggregations