use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.
the class NatVpnMapsChangeListener method onRouterDisassociatedFromVpn.
/**
* router disassociation from vpn.
*/
public void onRouterDisassociatedFromVpn(String vpnName, String routerName) {
// check router is associated to external network
String extNetwork = NatUtil.getAssociatedExternalNetwork(dataBroker, routerName);
if (extNetwork != null) {
try {
LOG.debug("onRouterDisassociatedFromVpn : Router {} is associated with ext nw {}", routerName, extNetwork);
handleDNATConfigurationForRouterDisassociation(routerName, vpnName, extNetwork);
Uuid extNetworkUuid = NatUtil.getNetworkIdFromRouterName(dataBroker, routerName);
if (extNetworkUuid == null) {
LOG.error("onRouterDisassociatedFromVpn : Unable to retrieve external network Uuid for router {}", routerName);
return;
}
ProviderTypes extNwProvType = NatEvpnUtil.getExtNwProvTypeFromRouterName(dataBroker, routerName, extNetworkUuid);
if (extNwProvType == null) {
LOG.error("onRouterDisassociatedFromVpn : External Network Provider Type missing");
return;
}
Uint32 routerId = NatUtil.getVpnId(dataBroker, routerName);
txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> externalRoutersListener.changeBgpVpnIdToLocalVpnId(routerName, routerId, extNetwork, vpnName, tx, extNwProvType)).get();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error changing BGP VPN identifier to local VPN identifier", e);
}
} else {
LOG.debug("onRouterDisassociatedFromVpn : Ignoring the Router {} association with VPN {} " + "since it is not external router", routerName, vpnName);
}
}
use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.
the class IngressAclServiceImpl method bindService.
/**
* Bind service.
*
* @param aclInterface the acl interface
*/
@Override
public void bindService(AclInterface aclInterface) {
String interfaceName = aclInterface.getInterfaceId();
jobCoordinator.enqueueJob(interfaceName, () -> {
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_ACL_DUMMY_TABLE, ++instructionKey));
int flowPriority = NwConstants.EGRESS_ACL_SERVICE_INDEX;
short serviceIndex = ServiceIndex.getIndex(NwConstants.EGRESS_ACL_SERVICE_NAME, NwConstants.EGRESS_ACL_SERVICE_INDEX);
BoundServices serviceInfo = AclServiceUtils.getBoundServices(String.format("%s.%s.%s", "acl", "egressacl", interfaceName), serviceIndex, flowPriority, AclConstants.COOKIE_ACL_BASE, instructions);
InstanceIdentifier<BoundServices> path = AclServiceUtils.buildServiceId(interfaceName, serviceIndex, serviceMode);
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> tx.mergeParentStructurePut(path, serviceInfo)));
});
}
use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.
the class EgressAclServiceImpl method bindService.
/**
* Bind service.
*
* @param aclInterface the acl interface
*/
@Override
public void bindService(AclInterface aclInterface) {
String interfaceName = aclInterface.getInterfaceId();
LOG.debug("Binding ACL service for interface {}", interfaceName);
if (aclInterface.getInterfaceType() == InterfaceType.DhcpService) {
LOG.debug("{} is a DHCP serice port. No binding needed", interfaceName);
return;
}
jobCoordinator.enqueueJob(interfaceName, () -> {
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(getAclAntiSpoofingTable(), ++instructionKey));
short serviceIndex = ServiceIndex.getIndex(AclConstants.INGRESS_ACL_SERVICE_NAME, AclConstants.INGRESS_ACL_SERVICE_INDEX);
int flowPriority = AclConstants.INGRESS_ACL_SERVICE_INDEX;
BoundServices serviceInfo = AclServiceUtils.getBoundServices(String.format("%s.%s.%s", "acl", "ingressacl", interfaceName), serviceIndex, flowPriority, AclConstants.COOKIE_ACL_BASE, instructions);
InstanceIdentifier<BoundServices> path = AclServiceUtils.buildServiceId(interfaceName, serviceIndex, serviceMode);
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> tx.mergeParentStructurePut(path, serviceInfo)));
});
}
use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method installRemoteMcastMac.
public void installRemoteMcastMac(final Uint64 designatedDpnId, final IpAddress tunnelIp, final String elanInstanceName) {
if (designatedDpnId.equals(DhcpMConstants.INVALID_DPID)) {
return;
}
jobCoordinator.enqueueJob(getJobKey(elanInstanceName), () -> {
if (!entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
LOG.info("Installing remote McastMac is not executed for this node.");
return Collections.emptyList();
}
LOG.info("Installing remote McastMac");
L2GatewayDevice device = getDeviceFromTunnelIp(tunnelIp);
if (device == null) {
LOG.error("Unable to get L2Device for tunnelIp {} and elanInstanceName {}", tunnelIp, elanInstanceName);
return Collections.emptyList();
}
String tunnelInterfaceName = getExternalTunnelInterfaceName(String.valueOf(designatedDpnId), device.getHwvtepNodeId());
if (tunnelInterfaceName != null) {
Interface tunnelInterface = interfaceManager.getInterfaceInfoFromConfigDataStore(tunnelInterfaceName);
if (tunnelInterface == null) {
LOG.trace("Tunnel Interface is not present {}", tunnelInterfaceName);
return Collections.emptyList();
}
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> putRemoteMcastMac(tx, elanInstanceName, device, tunnelInterface.augmentation(IfTunnel.class).getTunnelSource())));
}
return Collections.emptyList();
});
}
use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.
the class DhcpSubnetListener method uninstallNeutronPortEntries.
private void uninstallNeutronPortEntries(List<Uuid> portList) {
LOG.trace("DhcpSubnetListener uninstallNeutronPortEntries : portList: {}", portList);
for (Uuid portIntf : portList) {
NodeConnectorId nodeConnectorId = getNodeConnectorIdForPortIntf(portIntf);
Uint64 dpId = DhcpServiceUtils.getDpnIdFromNodeConnectorId(nodeConnectorId);
String interfaceName = portIntf.getValue();
Port port = dhcpManager.getNeutronPort(interfaceName);
String vmMacAddress = port.getMacAddress().getValue();
// check whether any changes have happened
LOG.trace("DhcpSubnetListener uninstallNeutronPortEntries dpId: {} vmMacAddress : {}", dpId, vmMacAddress);
// Unbind the dhcp service when disabled
LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> DhcpServiceUtils.unbindDhcpService(interfaceName, tx)), LOG, "Error writing to the datastore");
// uninstall the entries
LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx -> dhcpManager.unInstallDhcpEntries(dpId, vmMacAddress, tx)), LOG, "Error writing to the datastore");
}
}
Aggregations