use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project netvirt by opendaylight.
the class OpenFlow13ProviderTest method checkMatchTunDstIp.
private void checkMatchTunDstIp(Match match, Ipv4Address value) {
GeneralAugMatchNodesNodeTableFlow genAug = match.getAugmentation(GeneralAugMatchNodesNodeTableFlow.class);
assertNotNull(genAug);
List<ExtensionList> extensions = genAug.getExtensionList();
for (ExtensionList extensionList : extensions) {
Extension extension = extensionList.getExtension();
NxAugMatchNodesNodeTableFlow nxAugMatch = extension.getAugmentation(NxAugMatchNodesNodeTableFlow.class);
if (nxAugMatch.getNxmNxTunIpv4Dst() != null) {
assertEquals(nxAugMatch.getNxmNxTunIpv4Dst().getIpv4Address(), value);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project netvirt by opendaylight.
the class OpenFlow13ProviderTest method checkMatchC2.
private void checkMatchC2(Match match, long c2) {
GeneralAugMatchNodesNodeTableFlow genAug = match.getAugmentation(GeneralAugMatchNodesNodeTableFlow.class);
assertNotNull(genAug);
List<ExtensionList> extensions = genAug.getExtensionList();
for (ExtensionList extensionList : extensions) {
Extension extension = extensionList.getExtension();
NxAugMatchNodesNodeTableFlow nxAugMatch = extension.getAugmentation(NxAugMatchNodesNodeTableFlow.class);
if (nxAugMatch.getNxmNxNshc2() != null) {
assertEquals(nxAugMatch.getNxmNxNshc2().getValue().longValue(), c2);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project netvirt by opendaylight.
the class NeutronvpnUtils method getProviderNetworkType.
static ProviderTypes getProviderNetworkType(Network network) {
if (network == null) {
LOG.error("Error in getting provider network type since network is null");
return null;
}
NetworkProviderExtension npe = network.getAugmentation(NetworkProviderExtension.class);
if (npe != null) {
Class<? extends NetworkTypeBase> networkTypeBase = npe.getNetworkType();
if (networkTypeBase != null) {
if (networkTypeBase.isAssignableFrom(NetworkTypeFlat.class)) {
return ProviderTypes.FLAT;
} else if (networkTypeBase.isAssignableFrom(NetworkTypeVlan.class)) {
return ProviderTypes.VLAN;
} else if (networkTypeBase.isAssignableFrom(NetworkTypeVxlan.class)) {
return ProviderTypes.VXLAN;
} else if (networkTypeBase.isAssignableFrom(NetworkTypeGre.class)) {
return ProviderTypes.GRE;
}
}
}
LOG.error("Error in getting provider network type since network provider extension is null for network " + "{}", network.getUuid().getValue());
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension 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;
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.
the class ArpOpConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfArpOpGrouping> matchGrouping = MatchUtil.ARP_OP_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Integer value = matchGrouping.get().getNxmOfArpOp().getValue();
ArpOpCaseValueBuilder arpOpCaseValueBuilder = new ArpOpCaseValueBuilder();
arpOpCaseValueBuilder.setArpOpValues(new ArpOpValuesBuilder().setValue(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpOp.class, Nxm0Class.class, arpOpCaseValueBuilder.build()).build();
}
Aggregations