use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network in project netvirt by opendaylight.
the class VpnManagerImpl method addArpResponderFlowsToExternalNetworkIps.
@Override
public void addArpResponderFlowsToExternalNetworkIps(String id, Collection<String> fixedIps, String macAddress, BigInteger dpnId, Uuid extNetworkId, WriteTransaction writeTx) {
if (dpnId == null || BigInteger.ZERO.equals(dpnId)) {
LOG.warn("Failed to install arp responder flows for router {}. DPN id is missing.", id);
return;
}
String extInterfaceName = elanService.getExternalElanInterface(extNetworkId.getValue(), dpnId);
if (extInterfaceName != null) {
doAddArpResponderFlowsToExternalNetworkIps(id, fixedIps, macAddress, dpnId, extNetworkId, writeTx, extInterfaceName);
return;
}
LOG.warn("Failed to install responder flows for {}. No external interface found for DPN id {}", id, dpnId);
if (!upgradeState.isUpgradeInProgress()) {
return;
}
// The following through the end of the function deals with an upgrade scenario where the neutron configuration
// is restored before the OVS switches reconnect. In such a case, the elan-dpn-interfaces entries will be
// missing from the operational data store. In order to mitigate this we use DataTreeEventCallbackRegistrar
// to wait for the exact operational md-sal object we need to contain the external interface we need.
LOG.info("Upgrade in process, waiting for an external interface to appear on dpn {} for elan {}", dpnId, extNetworkId.getValue());
InstanceIdentifier<DpnInterfaces> dpnInterfacesIid = elanService.getElanDpnInterfaceOperationalDataPath(extNetworkId.getValue(), dpnId);
eventCallbacks.onAddOrUpdate(LogicalDatastoreType.OPERATIONAL, dpnInterfacesIid, (unused, alsoUnused) -> {
LOG.info("Reattempting write of arp responder for external interfaces for external network {}", extNetworkId);
DpnInterfaces dpnInterfaces = elanService.getElanInterfaceInfoByElanDpn(extNetworkId.getValue(), dpnId);
if (dpnInterfaces == null) {
LOG.error("Could not retrieve DpnInterfaces for {}, {}", extNetworkId.getValue(), dpnId);
return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
}
String extIfc = null;
for (String dpnInterface : dpnInterfaces.getInterfaces()) {
if (interfaceManager.isExternalInterface(dpnInterface)) {
extIfc = dpnInterface;
break;
}
}
if (extIfc == null) {
if (upgradeState.isUpgradeInProgress()) {
LOG.info("External interface not found yet in elan {} on dpn {}, keep waiting", extNetworkId.getValue(), dpnInterfaces);
return DataTreeEventCallbackRegistrar.NextAction.CALL_AGAIN;
} else {
return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
}
}
final String extIfcFinal = extIfc;
ListenableFuture<Void> listenableFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
doAddArpResponderFlowsToExternalNetworkIps(id, fixedIps, macAddress, dpnId, extNetworkId, tx, extIfcFinal);
});
ListenableFutures.addErrorLogging(listenableFuture, LOG, "Error while configuring arp responder for ext. interface");
return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network in project netvirt by opendaylight.
the class ElanDpnInterfacesListener method update.
@Override
protected void update(InstanceIdentifier<DpnInterfaces> identifier, DpnInterfaces original, DpnInterfaces update) {
LOG.debug("received Dpninterfaces update event for dpn {}", update.getDpId());
BigInteger dpnId = update.getDpId();
String elanInstanceName = identifier.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
ElanInstance elanInstance = elanInstanceCache.get(elanInstanceName).orNull();
if (elanInstance != null && !elanInstance.isExternal() && ElanUtils.isVlan(elanInstance)) {
List<String> interfaces = update.getInterfaces();
// trigger deletion for vlan provider intf on the DPN for the vlan provider network
if (interfaces.size() == 1 && interfaceManager.isExternalInterface(interfaces.get(0))) {
LOG.debug("deleting vlan prv intf for elan {}, dpn {}", elanInstanceName, dpnId);
jobCoordinator.enqueueJob(dpnId.toString(), () -> {
elanService.deleteExternalElanNetwork(elanInstance, dpnId);
return Collections.emptyList();
});
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network in project netvirt by opendaylight.
the class ElanDpnToTransportZoneListener method remove.
@Override
protected void remove(InstanceIdentifier<DpnInterfaces> key, DpnInterfaces dataObjectModification) {
LOG.debug("Elan dpn {} delete detected, deleting transport zones", dataObjectModification.getDpId());
BigInteger dpId = dataObjectModification.getDpId();
String elanInstanceName = key.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
if (!ElanUtils.isVxlanNetworkOrVxlanSegment(elanInstanceCache.get(elanInstanceName).orNull())) {
LOG.debug("ElanInstance {} is not vxlan network, nothing to do", elanInstanceName);
return;
}
LOG.debug("Deleting tz for elanInstance {} dpId {}", elanInstanceName, dpId);
transportZoneNotificationUtil.deleteTransportZone(elanInstanceName, dpId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network in project netvirt by opendaylight.
the class NetworkL2gwDeviceInfoCli method doExecute.
@Override
protected Object doExecute() {
List<Node> nodes = new ArrayList<>();
Set<String> networks = new HashSet<>();
if (nodeId == null) {
Optional<Topology> topologyOptional = MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, createHwvtepTopologyInstanceIdentifier());
if (topologyOptional.isPresent()) {
nodes = topologyOptional.get().getNode();
}
} else {
Optional<Node> nodeOptional = MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, createInstanceIdentifier(new NodeId(new Uri(nodeId))));
if (nodeOptional.isPresent()) {
nodes.add(nodeOptional.get());
}
}
if (elanName == null) {
// get all elan instance
// get all device node id
// print result
Optional<ElanInstances> elanInstancesOptional = MDSALUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(ElanInstances.class).build());
if (elanInstancesOptional.isPresent()) {
List<ElanInstance> elans = elanInstancesOptional.get().getElanInstance();
if (elans != null) {
for (ElanInstance elan : elans) {
networks.add(elan.getElanInstanceName());
}
}
}
} else {
networks.add(elanName);
}
for (Node node : nodes) {
if (node.getNodeId().getValue().contains("physicalswitch")) {
continue;
}
Node hwvtepConfigNode = HwvtepUtils.getHwVtepNode(dataBroker, LogicalDatastoreType.CONFIGURATION, node.getNodeId());
Node hwvtepOpPsNode = getPSnode(node, LogicalDatastoreType.OPERATIONAL);
Node hwvtepConfigPsNode = null;
if (hwvtepOpPsNode != null) {
hwvtepConfigPsNode = HwvtepUtils.getHwVtepNode(dataBroker, LogicalDatastoreType.CONFIGURATION, hwvtepOpPsNode.getNodeId());
opPSNodes.put(node.getNodeId(), hwvtepOpPsNode);
}
opNodes.put(node.getNodeId(), node);
configNodes.put(node.getNodeId(), hwvtepConfigNode);
if (hwvtepConfigPsNode != null) {
configPSNodes.put(node.getNodeId(), hwvtepConfigPsNode);
}
}
for (String network : networks) {
session.getConsole().println("Network info for " + network);
for (Node node : nodes) {
if (node.getNodeId().getValue().contains("physicalswitch")) {
continue;
}
session.getConsole().println("Printing for node " + node.getNodeId().getValue());
process(node.getNodeId(), network);
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network in project netvirt by opendaylight.
the class ElanInterfaceManager method remove.
@Override
protected void remove(InstanceIdentifier<ElanInterface> identifier, ElanInterface del) {
String interfaceName = del.getName();
ElanInstance elanInfo = elanInstanceCache.get(del.getElanInstanceName()).orNull();
/*
* Handling in case the elan instance is deleted.If the Elan instance is
* deleted, there is no need to explicitly delete the elan interfaces
*/
if (elanInfo == null) {
return;
}
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
if (interfaceInfo == null && elanInfo.isExternal()) {
// In deleting external network, the underlying ietf Inteface might have been removed
// from the config DS prior to deleting the ELAN interface. We try to get the InterfaceInfo
// from Operational DS instead
interfaceInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(interfaceName);
}
String elanInstanceName = elanInfo.getElanInstanceName();
InterfaceRemoveWorkerOnElan configWorker = new InterfaceRemoveWorkerOnElan(elanInstanceName, elanInfo, interfaceName, interfaceInfo, this);
jobCoordinator.enqueueJob(elanInstanceName, configWorker, ElanConstants.JOB_MAX_RETRIES);
}
Aggregations