private void makeConnectedRoute(long dpId, long vpnId, VrfEntry vrfEntry, String rd,
long groupId, int addOrRemove) {
+ LOG.trace("makeConnectedRoute: vrfEntry {}",vrfEntry);
String values[] = vrfEntry.getDestPrefix().split("/");
- LOG.debug("Adding route to DPN. ip {} masklen {}", values[0], values[1]);
String ipAddress = values[0];
- int prefixLength = Integer.parseInt(values[1]);
+ int prefixLength = (values.length == 1) ? 32 : Integer.parseInt(values[1]);
+ LOG.debug("Adding route to DPN. ip {} masklen {}", ipAddress, prefixLength);
InetAddress destPrefix = null;
try {
destPrefix = InetAddress.getByName(ipAddress);
if(addOrRemove == NwConstants.ADD_FLOW) {
actionsInfos.add(new ActionInfo(ActionType.group, new String[] { String.valueOf(groupId)}));
- actionsInfos.add(new ActionInfo(ActionType.push_mpls, new String[] { Long.toString(vrfEntry.getLabel())}));
+ actionsInfos.add(new ActionInfo(ActionType.push_mpls, new String[] { null }));
+ actionsInfos.add(new ActionInfo(ActionType.set_field_mpls_label, new String[] { Long.toString(vrfEntry.getLabel())}));
instructions.add(new InstructionInfo(InstructionType.write_actions, actionsInfos));
}
} else {
mdsalManager.removeFlow(flowEntity);
}
- LOG.debug("LFIB Entry for dpID {} : label : {} grpup {} modified successfully {}",dpId, label, groupId );
+ LOG.debug("LFIB Entry for dpID {} : label : {} group {} modified successfully {}",dpId, label, groupId );
}
private String getFlowRef(long dpnId, short tableId, long label, String nextHop) {
//TODO: This should be an MDSAL Util method
return Long.parseLong(IfmUtil.getDpnFromNodeConnectorId(port.getId()));
} catch (NullPointerException e) {
- LOG.error("OFPort for Interface {} not found", ifName);
+ LOG.error("dpn for Interface {} not found", ifName);
}
return 0L;
}
private static final FutureCallback<Void> DEFAULT_CALLBACK =
new FutureCallback<Void>() {
public void onSuccess(Void result) {
- LOG.info("Success in Datastore write operation");
+ LOG.debug("Success in Datastore write operation");
}
public void onFailure(Throwable error) {
LOG.error("Error in Datastore write operation", error);
long vpnId = getVpnId(vpnName);
long dpnId = interfaceManager.getDpnForInterface(ifName);
VpnNexthop nexthop = getVpnNexthop(vpnId, ipAddress);
+ LOG.trace("nexthop: {}", nexthop);
if (nexthop == null) {
List<BucketInfo> listBucketInfo = new ArrayList<BucketInfo>();
List<ActionInfo> listActionInfo = interfaceManager.getInterfaceEgressActions(ifName);
InstanceIdentifier<VpnNexthop> id1 = idBuilder
.child(VpnNexthop.class, new VpnNexthopKey(ipPrefix)).build();
-
+ LOG.trace("Adding nextHop {} to Operational DS", nh);
asyncWrite(LogicalDatastoreType.OPERATIONAL, id1, nh, DEFAULT_CALLBACK);
}
GetEgressPointerOutputBuilder output = new GetEgressPointerOutputBuilder();
String endpointIp = interfaceManager.getEndpointIpForDpn(input.getDpnId());
+ LOG.trace("getEgressPointer: input {}, endpointIp {}", input, endpointIp);
if (input.getNexthopIp().equals(endpointIp)) {
VpnNexthop vpnNextHop = getVpnNexthop(input.getVpnId(), input.getIpPrefix());
output.setEgressPointer(vpnNextHop.getEgressPointer());
package org.opendaylight.vpnservice.nexthopmgr;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
@Override
protected void add(InstanceIdentifier<Interface> identifier, Interface intrf) {
- LOG.info("key: " + identifier + ", value=" + intrf );
+ LOG.trace("key: " + identifier + ", value=" + intrf );
if (intrf.getType().equals(L3tunnel.class)) {
IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class);
- String gwIp = intfData.getGatewayIp().toString();
- String remoteIp = intfData.getRemoteIp().toString();
+ IpAddress gatewayIp = intfData.getGatewayIp();
+ String gwIp = (gatewayIp == null) ? null : gatewayIp.toString();
+ String remoteIp = null;
if (gwIp != null) {
remoteIp = gwIp;
+ } else {
+ IpAddress remIp = intfData.getRemoteIp();
+ remoteIp = (remIp == null) ? null : remIp.toString();
}
NodeConnectorId ofPort = intrf.getAugmentation(BaseIds.class).getOfPortId();
nexthopManager.createRemoteNextHop(intrf.getName(), ofPort.toString(), remoteIp);
long dpnId = interfaceManager.getDpnForInterface(intfName);
String nextHopIp = interfaceManager.getEndpointIpForDpn(dpnId);
- if (!nextHops.isEmpty()) {
- LOG.trace("NextHops are {}", nextHops);
- for (Adjacency nextHop : nextHops) {
- String key = nextHop.getIpAddress();
- long label = getUniqueId(key);
- updatePrefixToBGP(rd, nextHop, nextHopIp, label);
- value.add(new AdjacencyBuilder(nextHop).setLabel(label).build());
- }
+ LOG.trace("NextHops are {}", nextHops);
+ for (Adjacency nextHop : nextHops) {
+ String key = nextHop.getIpAddress();
+ long label = getUniqueId(key);
+ value.add(new AdjacencyBuilder(nextHop).setLabel(label).build());
}
+
Adjacencies aug = VpnUtil.getVpnInterfaceAugmentation(value);
VpnInterface opInterface = VpnUtil.getVpnInterface(intfName, intf.getVpnInstanceName(), aug);
InstanceIdentifier<VpnInterface> interfaceId = VpnUtil.getVpnInterfaceIdentifier(intfName);
asyncWrite(LogicalDatastoreType.OPERATIONAL, interfaceId, opInterface, DEFAULT_CALLBACK);
+ for (Adjacency nextHop : nextHops) {
+ String key = nextHop.getIpAddress();
+ long label = getUniqueId(key);
+ updatePrefixToBGP(rd, nextHop, nextHopIp, label);
+ }
}
}