import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
-import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.Lists;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Assert;
import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
-import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
-import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.PipelineOrchestrator;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
import org.opendaylight.ovsdb.utils.config.ConfigProperties;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeExternalIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntryBuilder;
+
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfoBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.InterfaceTypeEntryBuilder;
//Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
}
- private void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
- final ConnectionInfo connectionInfo) {
- InstanceIdentifier<Node> connectionNodePath = SouthboundMapper.createInstanceIdentifier(connectionInfo);
- ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath));
- }
-
- private List<ProtocolEntry> createMdsalProtocols() {
- List<ProtocolEntry> protocolList = new ArrayList<>();
- ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
- SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse();
- protocolList.add(new ProtocolEntryBuilder().
- setProtocol(mapper.get("OpenFlow13")).build());
- return protocolList;
- }
-
private OvsdbTerminationPointAugmentationBuilder createGenericOvsdbTerminationPointAugmentationBuilder() {
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointAugmentationBuilder =
new OvsdbTerminationPointAugmentationBuilder();
return result;
}
- /*
- * base method for adding test bridges. Other helper methods used to create bridges should utilize this method.
- *
- * @param connectionInfo
- * @param bridgeIid if passed null, one is created
- * @param bridgeName cannot be null
- * @param bridgeNodeId if passed null, one is created based on <code>bridgeIid</code>
- * @param setProtocolEntries toggles whether default protocol entries are set for the bridge
- * @param failMode toggles whether default fail mode is set for the bridge
- * @param setManagedBy toggles whether to setManagedBy for the bridge
- * @param dpType if passed null, this parameter is ignored
- * @param externalIds if passed null, this parameter is ignored
- * @param otherConfig if passed null, this parameter is ignored
- * @return success of bridge addition
- * @throws InterruptedException
- */
- private boolean addBridge(final ConnectionInfo connectionInfo, InstanceIdentifier<Node> bridgeIid,
- final String bridgeName, NodeId bridgeNodeId, final boolean setProtocolEntries,
- final Class<? extends OvsdbFailModeBase> failMode, final boolean setManagedBy,
- final Class<? extends DatapathTypeBase> dpType,
- final List<BridgeExternalIds> externalIds,
- final List<BridgeOtherConfigs> otherConfigs) throws InterruptedException {
-
- NodeBuilder bridgeNodeBuilder = new NodeBuilder();
- if (bridgeIid == null) {
- bridgeIid = SouthboundMapper.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
- }
- if (bridgeNodeId == null) {
- bridgeNodeId = SouthboundMapper.createManagedNodeId(bridgeIid);
- }
- bridgeNodeBuilder.setNodeId(bridgeNodeId);
- OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
- ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName));
- if (setProtocolEntries) {
- ovsdbBridgeAugmentationBuilder.setProtocolEntry(createMdsalProtocols());
- }
- if (failMode != null) {
- ovsdbBridgeAugmentationBuilder.setFailMode(failMode);
- }
- if (setManagedBy) {
- setManagedBy(ovsdbBridgeAugmentationBuilder, connectionInfo);
- }
- if (dpType != null) {
- ovsdbBridgeAugmentationBuilder.setDatapathType(dpType);
- }
- if (externalIds != null) {
- ovsdbBridgeAugmentationBuilder.setBridgeExternalIds(externalIds);
- }
- if (otherConfigs != null) {
- ovsdbBridgeAugmentationBuilder.setBridgeOtherConfigs(otherConfigs);
- }
- bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
- LOG.debug("Built with the intent to store bridge data {}",
- ovsdbBridgeAugmentationBuilder.toString());
- boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
- bridgeIid, bridgeNodeBuilder.build());
- Thread.sleep(OVSDB_UPDATE_TIMEOUT);
- return result;
- }
-
- private boolean addBridge(final ConnectionInfo connectionInfo, final String bridgeName)
- throws InterruptedException {
-
- return addBridge(connectionInfo, null, bridgeName, null, true,
- SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null, null);
- }
-
- private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo) {
- return getBridge(connectionInfo, NetvirtITConstants.BRIDGE_NAME);
- }
-
/**
* Extract the <code>store</code> type data store contents for the particular bridge identified by
* <code>bridgeName</code>.
return mdsalUtils.read(store, bridgeIid);
}
- /**
- * Extract the node contents from <code>LogicalDataStoreType.OPERATIONAL</code> data store for the
- * bridge identified by <code>bridgeName</code>
- *
- * @param connectionInfo
- * @param bridgeName
- * @return <code>LogicalDatastoreType.OPERATIONAL</code> type data store contents
- */
- private Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName) {
- return getBridgeNode(connectionInfo, bridgeName, LogicalDatastoreType.OPERATIONAL);
- }
-
- private boolean deleteBridge(ConnectionInfo connectionInfo) throws InterruptedException {
- return deleteBridge(connectionInfo, NetvirtITConstants.BRIDGE_NAME);
- }
-
private boolean deleteBridge(final ConnectionInfo connectionInfo, final String bridgeName)
throws InterruptedException {
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashSet;
-import java.util.Set;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeSystem;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableBiMap;
public class SouthboundMapper {
private static final Logger LOG = LoggerFactory.getLogger(SouthboundMapper.class);
return new NodeId(uri);
}
- public static InetAddress createInetAddress(IpAddress ip) throws UnknownHostException {
- if (ip.getIpv4Address() != null) {
- return InetAddress.getByName(ip.getIpv4Address().getValue());
- } else if (ip.getIpv6Address() != null) {
- return InetAddress.getByName(ip.getIpv6Address().getValue());
- } else {
- throw new UnknownHostException("IP Address has no value");
- }
- }
-
- public static DatapathId createDatapathId(Set<String> dpids) {
- Preconditions.checkNotNull(dpids);
- if (dpids.isEmpty()) {
- return null;
- } else {
- String[] dpidArray = new String[dpids.size()];
- dpids.toArray(dpidArray);
- return createDatapathId(dpidArray[0]);
- }
- }
-
- public static String createDatapathType(OvsdbBridgeAugmentation mdsalbridge) {
- String datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class);
-
- if (mdsalbridge.getDatapathType() != null && !mdsalbridge.getDatapathType().equals(DatapathTypeBase.class)) {
- datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType());
- if (datapathtype == null) {
- throw new IllegalArgumentException("Unknown datapath type " + mdsalbridge.getDatapathType().getName());
- }
- }
- return datapathtype;
- }
-
- public static Class<? extends DatapathTypeBase> createDatapathType(String type) {
- Preconditions.checkNotNull(type);
- if (type.isEmpty()) {
- return DatapathTypeSystem.class;
- } else {
- ImmutableBiMap<String, Class<? extends DatapathTypeBase>> mapper =
- SouthboundConstants.DATAPATH_TYPE_MAP.inverse();
- return mapper.get(type);
- }
- }
-
- public static DatapathId createDatapathId(String dpid) {
- Preconditions.checkNotNull(dpid);
- DatapathId datapath;
- if (dpid.matches("^[0-9a-fA-F]{16}")) {
- Splitter splitter = Splitter.fixedLength(2);
- Joiner joiner = Joiner.on(":");
- datapath = new DatapathId(joiner.join(splitter.split(dpid)));
- } else {
- datapath = new DatapathId(dpid);
- }
- return datapath;
- }
-
- public static Set<String> createOvsdbBridgeProtocols(OvsdbBridgeAugmentation ovsdbBridgeNode) {
- Set<String> protocols = new HashSet<>();
- if (ovsdbBridgeNode.getProtocolEntry() != null && ovsdbBridgeNode.getProtocolEntry().size() > 0) {
- for (ProtocolEntry protocol : ovsdbBridgeNode.getProtocolEntry()) {
- if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) {
- protocols.add(SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()));
- } else {
- throw new IllegalArgumentException("Unknown protocol " + protocol.getProtocol());
- }
- }
- }
- return protocols;
- }
-
public static Class<? extends InterfaceTypeBase> createInterfaceType(String type) {
Preconditions.checkNotNull(type);
return SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.get(type);
}
-
- public static String createOvsdbInterfaceType(Class<? extends InterfaceTypeBase> mdsaltype) {
- Preconditions.checkNotNull(mdsaltype);
- ImmutableBiMap<Class<? extends InterfaceTypeBase>, String> mapper =
- SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.inverse();
- return mapper.get(mdsaltype);
- }
}
import org.opendaylight.ovsdb.openstack.netvirt.sfc.ISfcClassifierService;
import org.opendaylight.ovsdb.openstack.netvirt.sfc.NshUtils;
import org.opendaylight.ovsdb.openstack.netvirt.sfc.SfcUtils;
-import org.opendaylight.ovsdb.southbound.SouthboundConstants;
import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
import org.opendaylight.sfc.provider.api.SfcProviderRenderedPathAPI;
import org.opendaylight.sfc.provider.api.SfcProviderServiceForwarderAPI;
import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfName;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.data.plane.locator.locator.type.Ip;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInput;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInputBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.Ace;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.Matches;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.acl.rev150105.RedirectToSfc;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.Classifiers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.Classifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
import org.osgi.framework.ServiceReference;
private volatile Southbound southbound;
private volatile ISfcClassifierService sfcClassifierService;
private static final short SFC_TABLE = 150;
- private static final int GPE_PORT = 6633;
- private static final String NETWORK_TYPE_VXLAN = "vxlan";
private MdsalUtils mdsalUtils;
private SfcUtils sfcUtils;
private static final String VXGPE = "vxgpe";
- private static final String TUNNEL_DST = "192.168.120.31";
- private static final String TUNNEL_VNID = "10";
public static final String TUNNEL_ENDPOINT_KEY = "local_ip";
public NetvirtSfcWorkaroundOF13Provider(final DataBroker dataBroker, MdsalUtils mdsalUtils, SfcUtils sfcUtils) {
handleRenderedServicePath(rsp, entry);
}
- private void handleRenderedServicePathOld(RenderedServicePath rsp, Ace entry) {
- LOG.info("handleRenderedServicePath: RSP: {}", rsp);
-
- Matches matches = entry.getMatches();
- if (matches == null) {
- LOG.warn("processAclEntry: matches not found");
- return;
- }
-
- List<RenderedServicePathHop> pathHopList = rsp.getRenderedServicePathHop();
- if (pathHopList.isEmpty()) {
- LOG.warn("handleRenderedServicePath: RSP {} has empty hops!!", rsp.getName());
- return;
- }
- LOG.info("handleRenderedServicePath: pathHopList: {}", pathHopList);
-
- final List<Node> bridgeNodes = nodeCacheManager.getBridgeNodes();
- if (bridgeNodes == null || bridgeNodes.isEmpty()) {
- LOG.warn("handleRenderedServicePath: There are no bridges to process");
- return;
- }
- for (Node bridgeNode : bridgeNodes) {
- OvsdbBridgeAugmentation ovsdbBridgeAugmentation = southbound.getBridge(bridgeNode, "br-int");
- if (ovsdbBridgeAugmentation == null) {
- continue;
- }
- long vxGpeOfPort = getOFPort(bridgeNode, VXGPE);
- if (vxGpeOfPort == 0L) {
- LOG.warn("programAclEntry: Could not identify tunnel port {} -> OF ({}) on {}",
- VXGPE, vxGpeOfPort, bridgeNode);
- continue;
- }
- long dataPathId = southbound.getDataPathId(bridgeNode);
- if (dataPathId == 0L) {
- LOG.warn("programAclEntry: Could not identify datapathId on {}", bridgeNode);
- continue;
- }
-
- // Find the first Hop within an RSP.
- // The classifier flow needs to send all matched traffic to this first hop SFF.
- RenderedServicePathFirstHop firstRspHop = SfcProviderRenderedPathAPI
- .readRenderedServicePathFirstHop(rsp.getName());
-
- LOG.info("handleRenderedServicePath: firstRspHop: {}", firstRspHop);
- LOG.debug("handleRenderedServicePath: First Hop IPAddress = {}, Port = {}",
- firstRspHop.getIp().getIpv4Address().getValue(),
- firstRspHop.getPort().getValue());
-
- NshUtils nshHeader = new NshUtils();
- nshHeader.setNshMetaC1(NshUtils.convertIpAddressToLong(new Ipv4Address(TUNNEL_DST)));
- nshHeader.setNshMetaC2(Long.parseLong(TUNNEL_VNID)); // get from register //get from
- nshHeader.setNshNsp(rsp.getPathId());
-
- RenderedServicePathHop firstHop = pathHopList.get(0);
- RenderedServicePathHop lastHop = pathHopList.get(pathHopList.size()-1);
- ServiceFunction serviceFunction =
- SfcProviderServiceFunctionAPI.readServiceFunction(
- SfName.getDefaultInstance(firstHop.getServiceFunctionName().getValue()));
- if (serviceFunction == null) {
- LOG.warn("programAclEntry: Could not identify ServiceFunction {} on {}",
- firstHop.getServiceFunctionName().getValue(), bridgeNode);
- continue;
- }
-
- nshHeader.setNshNsi(firstHop.getServiceIndex());
- // workaround: bypass sff and got directly to sf
- //nshHeader.setNshTunIpDst(firstRspHop.getIp().getIpv4Address());
- IpAddress sfIpAddress = sfcUtils.getSfIpAddress(serviceFunction);
- String sfDplName = sfcUtils.getSfDplName(serviceFunction);
- //sfcUtils.getSfIp(firstHop.getServiceFunctionName().getValue());
- nshHeader.setNshTunIpDst(sfIpAddress.getIpv4Address());
- nshHeader.setNshTunUdpPort(firstRspHop.getPort());
- LOG.debug("handleRenderedServicePath: NSH Header = {}", nshHeader);
-
- sfcClassifierService.programIngressClassifier(dataPathId, entry.getRuleName(), matches,
- nshHeader, vxGpeOfPort, true);
-
- sfcClassifierService.program_sfEgress(dataPathId, GPE_PORT, true);
- long sfOfPort = getSfPort(bridgeNode, sfDplName);
-
- String sfMac = getMacFromExternalIds(bridgeNode, sfDplName);
- String sfIpString = new String(sfIpAddress.getValue());
- LOG.info("handleRenderedServicePath: sfDplName: {}, sfMac: {}, sfOfPort: {}, sfIpAddress: {}",
- sfDplName, sfMac, sfOfPort, sfIpString);
- if (sfMac != null) { // install if the sf is on this bridge, expand when using multiple bridges
- sfcClassifierService.program_sfIngress(dataPathId, GPE_PORT, sfOfPort, sfIpString, sfDplName, true);
- sfcClassifierService.programStaticArpEntry(dataPathId, 0L, sfMac, sfIpString, true);
- }
-
- short lastServiceindex = (short)((lastHop.getServiceIndex()).intValue() - 1);
- sfcClassifierService.programEgressClassifier(dataPathId, vxGpeOfPort, rsp.getPathId(),
- lastServiceindex, sfOfPort, 0, true);
- sfcClassifierService.programEgressClassifierBypass(dataPathId, vxGpeOfPort, rsp.getPathId(),
- lastServiceindex, sfOfPort, 0, true);
-
- sfcClassifierService.programSfcTable(dataPathId, vxGpeOfPort, SFC_TABLE, true);
- }
- }
-
private void handleRenderedServicePath(RenderedServicePath rsp, Ace entry) {
LOG.info("handleRenderedServicePath: RSP: {}", rsp);
return rsp;
}
- // loop through all ports looking for vxlan types, skip vxgpe, keep the rest
- // first pass we only have two tunnels: one for normal vxlan and the other for gpe
- // so just return the first non-gpe vxlan port
- private long getTunnelOfPort(Node bridgeNode, String vxGpePortName) {
- long port = 0L;
- List<OvsdbTerminationPointAugmentation> ovsdbTerminationPointAugmentations =
- southbound.getTerminationPointsOfBridge(bridgeNode);
- if (!ovsdbTerminationPointAugmentations.isEmpty()) {
- for (OvsdbTerminationPointAugmentation terminationPointAugmentation :
- ovsdbTerminationPointAugmentations) {
- if (terminationPointAugmentation.getInterfaceType() ==
- SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.get(NETWORK_TYPE_VXLAN)) {
- if (!terminationPointAugmentation.getName().equals(vxGpePortName)) {
- port = terminationPointAugmentation.getOfport();
- break;
- }
- }
- }
- }
- return port;
- }
-
private long getSfPort(Node bridgeNode, String sfPortName) {
return getOFPort(bridgeNode, sfPortName);
}
return ofPort;
}
- private String getMacFromOptions(Node bridgeNode, String portName) {
- String mac = null;
- OvsdbTerminationPointAugmentation port = southbound.extractTerminationPointAugmentation(bridgeNode, portName);
- LOG.info("getMac: portName: {}, bridgeNode: {},,, port: {}", portName, bridgeNode, port);
- if (port != null && port.getOptions() != null) {
- //mac = southbound.getOptionsValue(port.getOptions(), EXTERNAL_ID_VM_MAC);
- for (Options option : port.getOptions()) {
- LOG.info("getMac: option: {}", option);
- if (option.getOption().equals(Constants.EXTERNAL_ID_VM_MAC)) {
- mac = option.getValue();
- break;
- }
- }
- }
- return mac;
- }
-
private String getMacFromExternalIds(Node bridgeNode, String portName) {
String mac = null;
OvsdbTerminationPointAugmentation port = southbound.getTerminationPointOfBridge(bridgeNode, portName);
if (write) {
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructions = Lists.newArrayList();
- InstructionBuilder ib = new InstructionBuilder();
-
- /*List<Action> actionList = Lists.newArrayList();
-
- ActionBuilder ab = new ActionBuilder();
- ab.setAction(ActionUtils.nxMoveNshc2ToTunId());
- ab.setOrder(0);
- ab.setKey(new ActionKey(0));
- actionList.add(ab.build());
-
- ApplyActionsBuilder aab = new ApplyActionsBuilder();
- aab.setAction(actionList);
- ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
- ib.setOrder(instructions.size());
- ib.setKey(new InstructionKey(instructions.size()));
- instructions.add(ib.build());*/
- ib = InstructionUtils.createGotoTableInstructions(new InstructionBuilder(), getTable());
+ InstructionBuilder ib = InstructionUtils.createGotoTableInstructions(new InstructionBuilder(), getTable());
ib.setOrder(instructions.size());
ib.setKey(new InstructionKey(instructions.size()));
instructions.add(ib.build());
// Build the Actions to Add the NSH Header
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nshC1Load =
ActionUtils.nxLoadNshc1RegAction(header.getNshMetaC1());
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nshC2Load =
- ActionUtils.nxLoadNshc2RegAction(header.getNshMetaC2());
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nspLoad =
ActionUtils.nxSetNspAction(header.getNshNsp());
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nsiLoad =
int count = actionList.size();
actionList.add(new ActionBuilder()
.setKey(new ActionKey(count)).setOrder(count++).setAction(nshC1Load).build());
- //actionList.add(new ActionBuilder()
- // .setKey(new ActionKey(count)).setOrder(count++).setAction(nshC2Load).build());
actionList.add(new ActionBuilder()
.setKey(new ActionKey(count)).setOrder(count++).setAction(nspLoad).build());
actionList.add(new ActionBuilder()
if (matches.getAceType() instanceof AceIp) {
AceIp aceIp = (AceIp)matches.getAceType();
if (aceIp.getAceIpVersion() instanceof AceIpv4) {
- //AceIpv4 aceIpv4 = (AceIpv4) aceIp.getAceIpVersion();
- //MatchUtils.createSrcL3IPv4Match(matchBuilder, aceIpv4.getSourceIpv4Network());
- //MatchUtils.createDstL3IPv4Match(matchBuilder, aceIpv4.getDestinationIpv4Network());
MatchUtils.createIpProtocolMatch(matchBuilder, aceIp.getProtocol());
MatchUtils.addLayer4Match(matchBuilder, aceIp.getProtocol().intValue(), 0,
aceIp.getDestinationPortRange().getLowerPort().getValue());