use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project netvirt by opendaylight.
the class QosPolicyChangeListener method supportedQoSRuleTypes.
private void supportedQoSRuleTypes() {
QosRuleTypesBuilder qrtBuilder = new QosRuleTypesBuilder();
List<RuleTypes> value = new ArrayList<>();
value.add(getRuleTypes("bandwidth_limit_rules"));
value.add(getRuleTypes("dscp_marking_rules"));
qrtBuilder.setRuleTypes(value);
LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
InstanceIdentifier instanceIdentifier = InstanceIdentifier.create(Neutron.class).child(QosRuleTypes.class);
tx.merge(instanceIdentifier, qrtBuilder.build());
}), LOG, "Error setting up supported QoS rule types");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project netvirt by opendaylight.
the class NeutronPortChangeListener method update.
@Override
public void update(InstanceIdentifier<Port> identifier, Port original, Port update) {
LOG.trace("Received port update event: original={}, update={}", original, update);
if (Objects.equals(original, update)) {
return;
}
// 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());
if (network == null || !NeutronvpnUtils.isNetworkTypeSupported(network)) {
LOG.warn("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 (NeutronConstants.DEVICE_OWNER_ROUTER_INF.equals(update.getDeviceOwner())) {
handleRouterInterfaceAdded(update);
return;
}
if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(update.getDeviceOwner())) {
handleRouterGatewayUpdated(update, false);
} else if (NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(update.getDeviceOwner())) {
handleFloatingIpPortUpdated(original, update);
}
} else {
Set<FixedIps> oldIPs = getFixedIpSet(new ArrayList<>(original.nonnullFixedIps().values()));
Set<FixedIps> newIPs = getFixedIpSet(new ArrayList<>(update.nonnullFixedIps().values()));
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);
boolean isDhcpServerPort = neutronvpnConfig.isLimitBumtrafficToDhcpserver() && NeutronvpnUtils.isDhcpServerPort(update);
if (origSecurityEnabled || updatedSecurityEnabled || isDhcpServerPort) {
InstanceIdentifier<Interface> interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(portName);
jobCoordinator.enqueueJob("PORT- " + portName, () -> {
ListenableFuture<?> future = txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, confTx -> {
Optional<Interface> optionalInf = confTx.read(interfaceIdentifier).get();
if (optionalInf.isPresent()) {
InterfaceBuilder interfaceBuilder = new InterfaceBuilder(optionalInf.get());
if (origSecurityEnabled || updatedSecurityEnabled) {
InterfaceAcl infAcl = handlePortSecurityUpdated(original, update, origSecurityEnabled, updatedSecurityEnabled, interfaceBuilder).build();
interfaceBuilder.addAugmentation(infAcl);
} else if (isDhcpServerPort) {
Set<FixedIps> oldIPs = getFixedIpSet(new ArrayList<>(original.nonnullFixedIps().values()));
Set<FixedIps> newIPs = getFixedIpSet(new ArrayList<>(update.nonnullFixedIps().values()));
if (!oldIPs.equals(newIPs)) {
InterfaceAcl infAcl = neutronvpnUtils.getDhcpInterfaceAcl(update);
interfaceBuilder.addAugmentation(infAcl);
}
}
LOG.info("update: Of-port-interface updation for port {}", portName);
// Update OFPort interface for this neutron port
confTx.put(interfaceIdentifier, interfaceBuilder.build());
} else {
LOG.warn("update: Interface {} is not present", portName);
}
});
LoggingFutures.addErrorLogging(future, LOG, "update: Failed to update interface {} with networkId {}", portName, network);
return Collections.singletonList(future);
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project bgpcep by opendaylight.
the class CreateTunnelInstructionExecutor method buildAddressFamily.
private static AddressFamily buildAddressFamily(final TerminationPoint sp, final TerminationPoint dp) {
// We need the IGP augmentation -- it has IP addresses
final TerminationPoint1 sp1 = requireNonNull(sp.augmentation(TerminationPoint1.class));
final TerminationPoint1 dp1 = requireNonNull(dp.augmentation(TerminationPoint1.class));
// Get the types
final TerminationPointType spt = sp1.getIgpTerminationPointAttributes().getTerminationPointType();
final TerminationPointType dpt = dp1.getIgpTerminationPointAttributes().getTerminationPointType();
// The types have to match
Preconditions.checkArgument(spt.implementedInterface().equals(dpt.implementedInterface()));
// And they have to actually be Ip
final Ip sips = (Ip) spt;
final Ip dips = (Ip) dpt;
/*
* Now a bit of magic. We need to find 'like' addresses, e.g. both
* IPv4 or both IPv6. We are in IPv6-enabled world now, so let's
* prefer that.
*/
Optional<AddressFamily> ret = findIpv6(sips.getIpAddress(), dips.getIpAddress());
if (!ret.isPresent()) {
ret = findIpv4(sips.getIpAddress(), dips.getIpAddress());
}
// We need to have a ret now
Preconditions.checkArgument(ret != null, "Failed to find like Endpoint addresses");
return ret.get();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project bgpcep by opendaylight.
the class RouteDistinguisherUtil method parseRouteDistinguisher.
/**
* Parses three types of route distinguisher from given ByteBuf.
*/
public static RouteDistinguisher parseRouteDistinguisher(final ByteBuf buffer) {
Preconditions.checkState(buffer != null && buffer.isReadable(RD_LENGTH), "Cannot read Route Distinguisher from provided buffer.");
final int type = buffer.readUnsignedShort();
final RDType rdType = RDType.valueOf(type);
switch(rdType) {
case AS_2BYTE:
return new RouteDistinguisher(new RdTwoOctetAs(new StringBuilder().append(type).append(SEPARATOR).append(buffer.readUnsignedShort()).append(SEPARATOR).append(buffer.readUnsignedInt()).toString()));
case IPV4:
return new RouteDistinguisher(new RdIpv4(new StringBuilder().append(Ipv4Util.addressForByteBuf(buffer).getValue()).append(SEPARATOR).append(buffer.readUnsignedShort()).toString()));
case AS_4BYTE:
return new RouteDistinguisher(new RdAs(new StringBuilder().append(buffer.readUnsignedInt()).append(SEPARATOR).append(buffer.readUnsignedShort()).toString()));
default:
// now that this RD type is not supported, we want to read the remain 6 bytes
// in order to get the byte index correct
final StringBuilder routeDistiguisher = new StringBuilder();
for (int i = 0; i < 6; i++) {
routeDistiguisher.append("0x").append(Integer.toHexString(buffer.readByte() & 0xFF)).append(' ');
}
LOG.debug("Invalid Route Distinguisher: type={}, rawRouteDistinguisherValue={}", type, routeDistiguisher);
throw new IllegalArgumentException("Invalid Route Distinguisher type " + type);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method createTypes.
private static List<Types> createTypes(final UnkeyedListNode typesData) {
final List<Types> types = new ArrayList<>();
for (final UnkeyedListEntryNode node : typesData.body()) {
final TypesBuilder typesBuilder = new TypesBuilder();
node.findChildByArg(OP_NID).ifPresent(dataContainerChild -> typesBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) dataContainerChild.body())));
node.findChildByArg(VALUE_NID).ifPresent(dataContainerChild -> typesBuilder.setValue((Uint8) dataContainerChild.body()));
types.add(typesBuilder.build());
}
return types;
}
Aggregations