use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.vpnmap.RouterIdsKey in project netvirt by opendaylight.
the class ExternalRoutersListener method addOrDelDefFibRouteToSNAT.
private void addOrDelDefFibRouteToSNAT(String routerName, long routerId, long bgpVpnId, Uuid bgpVpnUuid, boolean create, WriteTransaction writeFlowInvTx) {
// Check if BGP VPN exists. If exists then invoke the new method.
if (bgpVpnId != NatConstants.INVALID_ID) {
if (bgpVpnUuid != null) {
String bgpVpnName = bgpVpnUuid.getValue();
LOG.debug("Populate the router-id-name container with the mapping BGP VPN-ID {} -> BGP VPN-NAME {}", bgpVpnId, bgpVpnName);
RouterIds rtrs = new RouterIdsBuilder().setKey(new RouterIdsKey(bgpVpnId)).setRouterId(bgpVpnId).setRouterName(bgpVpnName).build();
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, getRoutersIdentifier(bgpVpnId), rtrs);
}
addOrDelDefaultFibRouteForSnatWithBgpVpn(routerName, routerId, bgpVpnId, create, writeFlowInvTx);
return;
}
// Router ID is used as the internal VPN's name, hence the vrf-id in VpnInstance Op DataStore
addOrDelDefaultFibRouteForSNAT(routerName, routerId, create, writeFlowInvTx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.vpnmap.RouterIdsKey in project netvirt by opendaylight.
the class ExternalRoutersListener method changeLocalVpnIdToBgpVpnId.
/**
* router association to vpn.
*
* @param routerName - Name of router
* @param routerId - router id
* @param bgpVpnName BGP VPN name
*/
public void changeLocalVpnIdToBgpVpnId(String routerName, long routerId, String bgpVpnName, WriteTransaction writeFlowInvTx, ProviderTypes extNwProvType) {
LOG.debug("changeLocalVpnIdToBgpVpnId : Router associated to BGP VPN");
if (chkExtRtrAndSnatEnbl(new Uuid(routerName))) {
long bgpVpnId = NatUtil.getVpnId(dataBroker, bgpVpnName);
LOG.debug("changeLocalVpnIdToBgpVpnId : BGP VPN ID value {} ", bgpVpnId);
if (bgpVpnId != NatConstants.INVALID_ID) {
LOG.debug("changeLocalVpnIdToBgpVpnId : Populate the router-id-name container with the " + "mapping BGP VPN-ID {} -> BGP VPN-NAME {}", bgpVpnId, bgpVpnName);
RouterIds rtrs = new RouterIdsBuilder().setKey(new RouterIdsKey(bgpVpnId)).setRouterId(bgpVpnId).setRouterName(bgpVpnName).build();
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, getRoutersIdentifier(bgpVpnId), rtrs);
// Get the allocated Primary NAPT Switch for this router
LOG.debug("changeLocalVpnIdToBgpVpnId : Router ID value {} ", routerId);
LOG.debug("changeLocalVpnIdToBgpVpnId : Update the Router ID {} to the BGP VPN ID {} ", routerId, bgpVpnId);
addOrDelDefaultFibRouteForSnatWithBgpVpn(routerName, routerId, bgpVpnId, true, writeFlowInvTx);
// Get the group ID
BigInteger primarySwitchId = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerName);
createGroupId(getGroupIdKey(routerName));
installFlowsWithUpdatedVpnId(primarySwitchId, routerName, bgpVpnId, routerId, true, writeFlowInvTx, extNwProvType);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.vpnmap.RouterIdsKey in project netvirt by opendaylight.
the class ExternalRoutersListener method addOrDelDefFibRouteToSNAT.
private void addOrDelDefFibRouteToSNAT(String routerName, Uint32 routerId, Uint32 bgpVpnId, Uuid bgpVpnUuid, boolean create, TypedReadWriteTransaction<Configuration> confTx) throws ExecutionException, InterruptedException {
// Check if BGP VPN exists. If exists then invoke the new method.
if (bgpVpnId != NatConstants.INVALID_ID) {
if (bgpVpnUuid != null) {
String bgpVpnName = bgpVpnUuid.getValue();
LOG.debug("Populate the router-id-name container with the mapping BGP VPN-ID {} -> BGP VPN-NAME {}", bgpVpnId, bgpVpnName);
RouterIds rtrs = new RouterIdsBuilder().withKey(new RouterIdsKey(bgpVpnId)).setRouterId(bgpVpnId).setRouterName(bgpVpnName).build();
confTx.mergeParentStructurePut(getRoutersIdentifier(bgpVpnId), rtrs);
}
if (create) {
addDefaultFibRouteForSnatWithBgpVpn(routerName, routerId, bgpVpnId, confTx);
} else {
removeDefaultFibRouteForSnatWithBgpVpn(routerName, routerId, bgpVpnId, confTx);
}
return;
}
// Router ID is used as the internal VPN's name, hence the vrf-id in VpnInstance Op DataStore
addOrDelDefaultFibRouteForSNAT(routerName, routerId, create, confTx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.vpnmap.RouterIdsKey in project netvirt by opendaylight.
the class NeutronvpnManager method removeVpn.
public void removeVpn(Uuid vpnId) {
// read VPNMaps
VpnMap vpnMap = neutronvpnUtils.getVpnMap(vpnId);
if (vpnMap != null) {
Map<RouterIdsKey, RouterIds> keyRouterIdsMap = vpnMap.getRouterIds();
List<Uuid> routerUuidList = new ArrayList<>();
// dissociate router
if (keyRouterIdsMap != null && !keyRouterIdsMap.isEmpty()) {
for (RouterIds router : keyRouterIdsMap.values()) {
Uuid routerId = router.getRouterId();
routerUuidList.add(routerId);
dissociateRouterFromVpn(vpnId, routerId);
}
}
if (!routerUuidList.contains(vpnId) && vpnMap.getNetworkIds() != null) {
dissociateNetworksFromVpn(vpnId, vpnMap.getNetworkIds());
}
} else {
LOG.error("removeVpn: vpnMap is null for vpn {}", vpnId.getValue());
}
// remove entire vpnMaps node
deleteVpnMapsNode(vpnId);
// remove vpn-instance
deleteVpnInstance(vpnId);
LOG.debug("Deleted L3VPN with ID {}", vpnId.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.vpnmap.RouterIdsKey in project netvirt by opendaylight.
the class NatUtil method createRouterIdsConfigDS.
static void createRouterIdsConfigDS(DataBroker dataBroker, long routerId, String routerName) {
if (routerId == NatConstants.INVALID_ID) {
LOG.error("createRouterIdsConfigDS : invalid routerId for routerName {}", routerName);
return;
}
RouterIds rtrs = new RouterIdsBuilder().setKey(new RouterIdsKey(routerId)).setRouterId(routerId).setRouterName(routerName).build();
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, buildRouterIdentifier(routerId), rtrs);
}
Aggregations