use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class VpnElanInterfaceChangeListener method add.
@Override
protected void add(InstanceIdentifier<ElanInterface> key, ElanInterface elanInterface) {
String interfaceName = elanInterface.getName();
if (!elanService.isExternalInterface(interfaceName)) {
LOG.debug("add: Interface {} is not external. Ignoring", interfaceName);
return;
}
Uuid networkId;
try {
networkId = new Uuid(elanInterface.getElanInstanceName());
} catch (IllegalArgumentException e) {
LOG.debug("add: ELAN instance {} for interface {} is not Uuid", elanInterface.getElanInstanceName(), elanInterface.getName());
return;
}
Uuid vpnId = VpnUtil.getExternalNetworkVpnId(broker, networkId);
if (vpnId == null) {
LOG.debug("add: Network {} is not external or vpn-id missing. Ignoring interface {} on elan {}", networkId.getValue(), elanInterface.getName(), elanInterface.getElanInstanceName());
return;
}
VpnInstanceNames vpnInstance = VpnHelper.getVpnInterfaceVpnInstanceNames(vpnId.getValue(), AssociatedSubnetType.V4AndV6Subnets);
List<VpnInstanceNames> listVpn = new ArrayList<>();
listVpn.add(vpnInstance);
VpnInterface vpnInterface = new VpnInterfaceBuilder().setKey(new VpnInterfaceKey(interfaceName)).setVpnInstanceNames(listVpn).setScheduledForRemove(Boolean.FALSE).build();
InstanceIdentifier<VpnInterface> vpnInterfaceIdentifier = VpnUtil.getVpnInterfaceIdentifier(interfaceName);
VpnUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, vpnInterfaceIdentifier, vpnInterface);
LOG.info("add: Added VPN interface {} with VPN-id {} elanInstance {}", interfaceName, vpnId.getValue(), elanInterface.getElanInstanceName());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class SubnetmapChangeListener method add.
@Override
protected void add(InstanceIdentifier<Subnetmap> identifier, Subnetmap subnetmap) {
LOG.debug("SubnetmapChangeListener add subnetmap method - key: {}, value: {}", identifier, subnetmap);
Uuid subnetId = subnetmap.getId();
Network network = VpnUtil.getNeutronNetwork(dataBroker, subnetmap.getNetworkId());
if (network == null) {
LOG.error("SubnetMapChangeListener:add: network was not found for subnetId {}", subnetId.getValue());
return;
}
if (VpnUtil.getIsExternal(network)) {
LOG.debug("SubnetmapListener:add: provider subnetwork {} is handling in " + "ExternalSubnetVpnInstanceListener", subnetId.getValue());
return;
}
String elanInstanceName = subnetmap.getNetworkId().getValue();
long elanTag = getElanTag(elanInstanceName);
if (elanTag == 0L) {
LOG.error("SubnetMapChangeListener:add: unable to fetch elantag from ElanInstance {} for subnet {}", elanInstanceName, subnetId.getValue());
return;
}
if (subnetmap.getVpnId() != null) {
boolean isBgpVpn = !subnetmap.getVpnId().equals(subnetmap.getRouterId());
LOG.info("SubnetMapChangeListener:add: subnetmap {} with elanTag {} to VPN {}", subnetmap, elanTag, subnetmap.getVpnId());
vpnSubnetRouteHandler.onSubnetAddedToVpn(subnetmap, isBgpVpn, elanTag);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method newElan.
// FIXME copied from AclServiceTestBase
protected void newElan(String elanName, long elanId) throws TransactionCommitFailedException {
ElanInstance elan = new ElanInstanceBuilder().setElanInstanceName(elanName).setElanTag(5000L).build();
singleTransactionDataBroker.syncWrite(CONFIGURATION, AclServiceUtils.getElanInstanceConfigurationDataPath(elanName), elan);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ExternalSubnetVpnInstanceListener method invokeSubnetAddedToVpn.
private void invokeSubnetAddedToVpn(String externalSubnetId) {
Uuid externalSubnetUuid = new Uuid(externalSubnetId);
Subnetmap subnetMap = NatUtil.getSubnetMap(dataBroker, externalSubnetUuid);
if (subnetMap == null) {
LOG.error("invokeSubnetAddedToVpn : Cannot invoke onSubnetAddedToVpn for subnet-id {} in vpn-id {}" + " due to this subnet missing in Subnetmap model", externalSubnetUuid, externalSubnetId);
return;
}
ElanInstance elanInstance = elanService.getElanInstance(subnetMap.getNetworkId().getValue());
vpnManager.onSubnetAddedToVpn(subnetMap, false, elanInstance.getElanTag());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method getRemoteBCGroupBucketsOfElanL2GwDevices.
public List<Bucket> getRemoteBCGroupBucketsOfElanL2GwDevices(ElanInstance elanInfo, BigInteger dpnId, int bucketId) {
List<Bucket> listBucketInfo = new ArrayList<>();
ConcurrentMap<String, L2GatewayDevice> map = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanInfo.getElanInstanceName());
for (L2GatewayDevice device : map.values()) {
String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId), device.getHwvtepNodeId());
if (interfaceName == null) {
continue;
}
List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName, ElanUtils.getVxlanSegmentationId(elanInfo));
listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
}
return listBucketInfo;
}
Aggregations