use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class AbstractSnatService method addSnatMissEntry.
protected void addSnatMissEntry(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId, Uint32 routerId, String routerName, Uint64 primarySwitchId) {
LOG.debug("installSnatMissEntry : Installing SNAT miss entry in switch {}", dpnId);
List<ActionInfo> listActionInfoPrimary = new ArrayList<>();
String ifNamePrimary = NatUtil.getTunnelInterfaceName(dpnId, primarySwitchId, itmManager);
List<BucketInfo> listBucketInfo = new ArrayList<>();
if (ifNamePrimary != null) {
LOG.debug("installSnatMissEntry : On Non- Napt switch , Primary Tunnel interface is {}", ifNamePrimary);
listActionInfoPrimary = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager, interfaceManager, ifNamePrimary, routerId, true);
}
BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
listBucketInfo.add(0, bucketPrimary);
LOG.debug("installSnatMissEntry : installSnatMissEntry called for dpnId {} with primaryBucket {} ", dpnId, listBucketInfo.get(0));
// Install the select group
Uint32 groupId = NatUtil.getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME, getGroupIdKey(routerName));
if (groupId != NatConstants.INVALID_ID) {
GroupEntity groupEntity = MDSALUtil.buildGroupEntity(dpnId, groupId.longValue(), routerName, GroupTypes.GroupAll, listBucketInfo);
LOG.debug("installing the PSNAT to NAPTSwitch GroupEntity:{} with GroupId: {}", groupEntity, groupId);
mdsalManager.addGroup(confTx, groupEntity);
// Add the flow to send the packet to the group only after group is available in Config datastore
eventCallbacks.onAddOrUpdate(LogicalDatastoreType.CONFIGURATION, NatUtil.getGroupInstanceId(dpnId, groupId), (unused, newGroupId) -> {
LOG.info("group {} is created in the config", groupId);
LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, innerConfTx -> addSnatMissFlowForGroup(innerConfTx, dpnId, routerId, groupId)), LOG, "Error adding flow for the group {}", groupId);
return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
}, Duration.ofSeconds(5), iid -> LOG.error("groupId {} not found in config datastore", groupId));
} else {
LOG.error("installSnatMissEntry: Unable to get groupId for routerName:{}", routerName);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class NetworkL2gwDeviceInfoCli method process.
@SuppressWarnings("checkstyle:HiddenField")
void process(NodeId hwvtepNodeId, String elanName) {
Node hwvtepConfigNode = configNodes.get(hwvtepNodeId);
session.getConsole().println("Config Data >>");
printLocalUcastMacs(hwvtepConfigNode, elanName);
session.getConsole().println("Operational Data >>");
Node hwvtepOpNode = opNodes.get(hwvtepNodeId);
printLocalUcastMacs(hwvtepOpNode, elanName);
session.getConsole().println("Config Data >>");
printLocalMcastMacs(hwvtepConfigNode, elanName);
session.getConsole().println("Operational Data >>");
printLocalMcastMacs(hwvtepOpNode, elanName);
session.getConsole().println("Config Data >>");
printRemoteUcastMacs(hwvtepConfigNode, elanName);
session.getConsole().println("Operational Data >>");
printRemoteUcastMacs(hwvtepOpNode, elanName);
session.getConsole().println("Config Data >>");
printRemoteMcastMacs(hwvtepConfigNode, elanName);
session.getConsole().println("Operational Data >>");
printRemoteMcastMacs(hwvtepOpNode, elanName);
Node hwvtepConfigPsNode = configPSNodes.get(hwvtepNodeId);
session.getConsole().println("Config Data >>");
printVlanBindings(hwvtepConfigPsNode, elanName);
session.getConsole().println("Operational Data >>");
Node hwvtepOpPsNode = opPSNodes.get(hwvtepNodeId);
printVlanBindings(hwvtepOpPsNode, elanName);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class ElanBridgeManager method prepareIntegrationBridge.
private void prepareIntegrationBridge(Node ovsdbNode, Node brIntNode) {
if (southboundUtils.getBridgeFromConfig(ovsdbNode, INTEGRATION_BRIDGE) == null) {
LOG.debug("br-int in operational but not config, copying into config");
copyBridgeToConfig(brIntNode);
}
Map<String, String> providerMappings = getOpenvswitchOtherConfigMap(ovsdbNode, PROVIDER_MAPPINGS_KEY);
for (String value : providerMappings.values()) {
if (southboundUtils.extractTerminationPointAugmentation(brIntNode, value) != null) {
LOG.debug("prepareIntegrationBridge: port {} already exists on {}", value, INTEGRATION_BRIDGE);
continue;
}
Node exBridgeNode = southboundUtils.readBridgeNode(ovsdbNode, value);
if (exBridgeNode != null) {
LOG.debug("prepareIntegrationBridge: bridge {} found. Patching to {}", value, INTEGRATION_BRIDGE);
patchBridgeToBrInt(brIntNode, exBridgeNode, value);
} else {
LOG.debug("prepareIntegrationBridge: adding interface {} to {}", value, INTEGRATION_BRIDGE);
if (!addPortToBridge(brIntNode, INTEGRATION_BRIDGE, value)) {
LOG.error("Failed to add {} port to {}", value, brIntNode);
}
}
}
if (!addControllerToBridge(ovsdbNode, INTEGRATION_BRIDGE)) {
LOG.error("Failed to set controller to existing integration bridge {}", brIntNode);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class VpnFloatingIpHandler method removeFromFloatingIpPortInfo.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void removeFromFloatingIpPortInfo(Uuid floatingIpId) {
InstanceIdentifier id = buildfloatingIpIdToPortMappingIdentifier(floatingIpId);
try {
Optional<FloatingIpIdToPortMapping> optFloatingIpIdToPortMapping = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
if (optFloatingIpIdToPortMapping.isPresent() && optFloatingIpIdToPortMapping.get().isFloatingIpDeleted()) {
LOG.debug("Deleting floating IP UUID {} to Floating IP neutron port mapping from Floating " + "IP Port Info Config DS", floatingIpId.getValue());
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
}
} catch (Exception e) {
LOG.error("removeFromFloatingIpPortInfo : Deleting floating IP UUID {} to Floating IP neutron port " + "mapping from Floating IP Port Info Config DS failed", floatingIpId.getValue(), e);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class BgpConfigurationManager method onUpdatePushRoute.
/* onUpdatePushRoute
* Get Stale fibDSWriter map, and compare current route/fibDSWriter entry.
* - Entry compare shall include NextHop, Label.
* - If entry matches: delete from STALE Map. NO Change to FIB Config DS.
* - If entry not found, add to FIB Config DS.
* - If entry found, but either Label/NextHop doesn't match.
* - Update FIB Config DS with modified values.
* - delete from Stale Map.
*/
public void onUpdatePushRoute(protocol_type protocolType, String rd, String prefix, int plen, String nextHop, String macaddress, Uint32 label, Uint32 l2label, String routermac, af_afi afi) {
PrefixUpdateEvent prefixUpdateEvent = new PrefixUpdateEvent(protocolType, rd, prefix, plen, nextHop, macaddress, label, l2label, routermac, afi);
bgpUpdatesHistory.addToHistory(TransactionType.ADD, prefixUpdateEvent);
boolean addroute = false;
boolean macupdate = false;
Uint32 l3vni = Uint32.ZERO;
VrfEntry.EncapType encapType = VrfEntry.EncapType.Mplsgre;
if (protocolType.equals(protocol_type.PROTOCOL_EVPN)) {
encapType = VrfEntry.EncapType.Vxlan;
VpnInstanceOpDataEntry vpnInstanceOpDataEntry = bgpUtil.getVpnInstanceOpData(rd);
if (vpnInstanceOpDataEntry != null) {
if (vpnInstanceOpDataEntry.getType() == VpnInstanceOpDataEntry.Type.L2) {
LOG.info("Got RT2 route for RD {} l3label {} l2label {} from tep {} with mac {} remote RD {}", vpnInstanceOpDataEntry.getVpnInstanceName(), label, l2label, nextHop, macaddress, rd);
addTepToElanDS(rd, nextHop, macaddress, l2label);
macupdate = true;
} else {
l3vni = vpnInstanceOpDataEntry.getL3vni();
}
} else {
LOG.error("No corresponding vpn instance found for rd {}. Aborting.", rd);
return;
}
}
if (!staledFibEntriesMap.isEmpty()) {
// restart Scenario, as MAP is not empty.
Map<String, Uint32> map = staledFibEntriesMap.get(rd);
if (map != null) {
String prefixNextHop = appendNextHopToPrefix(prefix + "/" + plen, nextHop);
Uint32 labelInStaleMap = map.get(prefixNextHop);
if (null == labelInStaleMap) {
// New Entry, which happened to be added during restart.
addroute = true;
} else {
map.remove(prefixNextHop);
if (isRouteModified(label, labelInStaleMap)) {
LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix, plen, nextHop, label);
// Existing entry, where in Label got modified during restart
addroute = true;
}
}
} else {
LOG.debug("rd {} map is null while processing prefix {} ", rd, prefix);
addroute = true;
}
} else {
LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix, plen, nextHop, label);
addroute = true;
}
if (macupdate) {
LOG.info("ADD: Adding Mac Fib entry rd {} mac{} nexthop {} l2vni {}", rd, macaddress, nextHop, l2label);
fibDSWriter.addMacEntryToDS(rd, macaddress, prefix, Collections.singletonList(nextHop), encapType, l2label, routermac, RouteOrigin.BGP);
LOG.info("ADD: Added Mac Fib entry rd {} prefix {} nexthop {} label {}", rd, macaddress, nextHop, l2label);
} else if (addroute) {
LOG.info("ADD: Adding Fib entry rd {} prefix {} nexthop {} label {} afi {}", rd, prefix, nextHop, label, afi);
// TODO: modify addFibEntryToDS signature
List<String> nextHopList = Collections.singletonList(nextHop);
fibDSWriter.addFibEntryToDS(rd, prefix + "/" + plen, nextHopList, encapType, label, l3vni, routermac, RouteOrigin.BGP);
LOG.info("ADD: Added Fib entry rd {} prefix {} nexthop {} label {}", rd, prefix, nextHop, label);
String vpnName = bgpUtil.getVpnNameFromRd(rd);
if (vpnName != null) {
vpnLinkService.leakRouteIfNeeded(vpnName, prefix, nextHopList, label, RouteOrigin.BGP, NwConstants.ADD_FLOW);
}
}
}
Aggregations