use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap 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.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.
the class VpnHelper method getSubnetmapFromItsUuid.
/**
* Get Subnetmap from its Uuid.
* @param broker the data broker for look for data
* @param subnetUuid the subnet's Uuid
* @return the Subnetmap of Uuid or null if it is not found
*/
public static Subnetmap getSubnetmapFromItsUuid(DataBroker broker, Uuid subnetUuid) {
Subnetmap sn = null;
InstanceIdentifier<Subnetmap> id = buildSubnetmapIdentifier(subnetUuid);
Optional<Subnetmap> optionalSn = read(broker, LogicalDatastoreType.CONFIGURATION, id);
if (optionalSn.isPresent()) {
sn = optionalSn.get();
}
return sn;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.
the class ExternalNetworkGroupInstaller method installExtNetGroupEntries.
public void installExtNetGroupEntries(Uuid subnetId, String macAddress) {
Subnetmap subnetMap = NatUtil.getSubnetMap(broker, subnetId);
if (subnetMap == null) {
LOG.error("installExtNetGroupEntries : Subnetmap is null");
return;
}
if (NatUtil.isIPv6Subnet(subnetMap.getSubnetIp())) {
LOG.debug("installExtNetGroupEntries : Subnet-id {} is not an IPv4 subnet, hence skipping.", subnetMap.getId());
return;
}
installExtNetGroupEntries(subnetMap, macAddress);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.
the class ExternalSubnetVpnInstanceListener method invokeSubnetDeletedFromVpn.
private void invokeSubnetDeletedFromVpn(String externalSubnetId) {
Uuid externalSubnetUuid = new Uuid(externalSubnetId);
Subnetmap subnetMap = NatUtil.getSubnetMap(dataBroker, externalSubnetUuid);
vpnManager.onSubnetDeletedFromVpn(subnetMap, false);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap 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());
}
Aggregations