Fix nsh flow
[netvirt.git] / openstack / net-virt-sfc / it / src / test / java / org / opendaylight / ovsdb / openstack / netvirt / sfc / NetvirtSfcIT.java
1 /*
2  * Copyright © 2015 Red Hat, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.ovsdb.openstack.netvirt.sfc;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertNull;
14 import static org.junit.Assert.assertTrue;
15 import static org.junit.Assert.fail;
16 import static org.ops4j.pax.exam.CoreOptions.composite;
17 import static org.ops4j.pax.exam.CoreOptions.maven;
18 import static org.ops4j.pax.exam.CoreOptions.propagateSystemProperties;
19 import static org.ops4j.pax.exam.CoreOptions.vmOption;
20 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
21 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
22 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
23
24 import java.io.IOException;
25 import java.util.List;
26 import java.util.Properties;
27 import java.util.concurrent.atomic.AtomicBoolean;
28 import org.junit.Assert;
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.junit.runner.RunWith;
32 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
33 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
34 import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
35 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
36 import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
37 import org.opendaylight.ovsdb.openstack.netvirt.sfc.openflow13.NshUtils;
38 import org.opendaylight.ovsdb.openstack.netvirt.sfc.openflow13.SfcClassifier;
39 import org.opendaylight.ovsdb.openstack.netvirt.sfc.utils.AclUtils;
40 import org.opendaylight.ovsdb.openstack.netvirt.sfc.utils.ClassifierUtils;
41 import org.opendaylight.ovsdb.openstack.netvirt.sfc.utils.SfcUtils;
42 import org.opendaylight.ovsdb.southbound.SouthboundConstants;
43 import org.opendaylight.ovsdb.southbound.SouthboundUtil;
44 import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
45 import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
46 import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
47 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessLists;
48 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessListsBuilder;
49 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.AclBuilder;
50 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.AccessListEntriesBuilder;
51 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.AceBuilder;
52 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.ActionsBuilder;
53 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.MatchesBuilder;
54 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.Classifiers;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.ClassifiersBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.ClassifierBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.classifier.SffsBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.classifier.sffs.SffBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.rev150105.Sfc;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.rev150105.SfcBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
67 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
68 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
69 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
70 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
71 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
72 import org.opendaylight.yangtools.concepts.Builder;
73 import org.opendaylight.yangtools.yang.binding.DataObject;
74 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
75
76 import org.ops4j.pax.exam.Configuration;
77 import org.ops4j.pax.exam.Option;
78 import org.ops4j.pax.exam.junit.PaxExam;
79 import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
80 import org.ops4j.pax.exam.options.MavenUrlReference;
81 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
82 import org.ops4j.pax.exam.spi.reactors.PerClass;
83 import org.slf4j.Logger;
84 import org.slf4j.LoggerFactory;
85
86 @RunWith(PaxExam.class)
87 @ExamReactorStrategy(PerClass.class)
88 public class NetvirtSfcIT extends AbstractMdsalTestBase {
89     private static final Logger LOG = LoggerFactory.getLogger(NetvirtSfcIT.class);
90     private static AclUtils aclUtils = new AclUtils();
91     private static ClassifierUtils classifierUtils = new ClassifierUtils();
92     private static SfcUtils sfcUtils = new SfcUtils();
93     private static MdsalUtils mdsalUtils;
94     private static AtomicBoolean setup = new AtomicBoolean(false);
95     private static SouthboundUtils southboundUtils;
96     private static String addressStr;
97     private static String portStr;
98     private static String connectionType;
99     private static Southbound southbound;
100     private static DataBroker dataBroker;
101     public static final String CONTROLLER_IPADDRESS = "ovsdb.controller.address";
102     public static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
103     public static final String SERVER_PORT = "ovsdbserver.port";
104     public static final String CONNECTION_TYPE = "ovsdbserver.connection";
105     public static final String CONNECTION_TYPE_ACTIVE = "active";
106     public static final String CONNECTION_TYPE_PASSIVE = "passive";
107     public static final String DEFAULT_SERVER_PORT = "6640";
108     public static final String INTEGRATION_BRIDGE_NAME = "br-int";
109     private static final String NETVIRT_TOPOLOGY_ID = "netvirt:1";
110
111     @Override
112     public String getModuleName() {
113         return "netvirt-sfc";
114     }
115
116     @Override
117     public String getInstanceName() {
118         return "netvirt-sfc-default";
119     }
120
121     @Override
122     public MavenUrlReference getFeatureRepo() {
123         return maven()
124                 .groupId("org.opendaylight.ovsdb")
125                 .artifactId("openstack.net-virt-sfc-features-test")
126                 .classifier("features")
127                 .type("xml")
128                 .versionAsInProject();
129     }
130
131     @Override
132     public String getFeatureName() {
133         return "odl-ovsdb-sfc-test";
134     }
135
136     @Configuration
137     @Override
138     public Option[] config() {
139         Option[] parentOptions = super.config();
140         Option[] propertiesOptions = getPropertiesOptions();
141         Option[] otherOptions = getOtherOptions();
142         Option[] options = new Option[parentOptions.length + propertiesOptions.length + otherOptions.length];
143         System.arraycopy(parentOptions, 0, options, 0, parentOptions.length);
144         System.arraycopy(propertiesOptions, 0, options, parentOptions.length, propertiesOptions.length);
145         System.arraycopy(otherOptions, 0, options, parentOptions.length + propertiesOptions.length,
146                 otherOptions.length);
147         return options;
148     }
149
150     private Option[] getOtherOptions() {
151         return new Option[] {
152                 configureConsole().startLocalConsole(),
153                 vmOption("-javaagent:../jars/org.jacoco.agent.jar=destfile=../../jacoco-it.exec"),
154                 keepRuntimeFolder()
155         };
156     }
157
158     public Option[] getPropertiesOptions() {
159         return new Option[] {
160                 propagateSystemProperties(SERVER_IPADDRESS, SERVER_PORT, CONNECTION_TYPE, CONTROLLER_IPADDRESS),
161         };
162     }
163
164     @Override
165     public Option getLoggingOption() {
166         return composite(
167                 editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
168                         logConfiguration(NetvirtSfcIT.class),
169                         LogLevel.INFO.name()),
170                 editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
171                         "log4j.logger.org.opendaylight.ovsdb.openstack.netvirt.sfc",
172                         LogLevel.TRACE.name()),
173                 /*editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
174                         "log4j.logger.org.opendaylight.ovsdb",
175                         LogLevelOption.LogLevel.TRACE.name()),*/
176                 super.getLoggingOption());
177     }
178
179     protected String usage() {
180         return "Integration Test needs a valid connection configuration as follows :\n"
181                 + "active connection : mvn -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"
182                 + "passive connection : mvn -Dovsdbserver.connection=passive verify\n";
183     }
184
185     private void getProperties() {
186         Properties props = System.getProperties();
187         addressStr = props.getProperty(SERVER_IPADDRESS);
188         portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
189         connectionType = props.getProperty(CONNECTION_TYPE, "active");
190         LOG.info("setUp: Using the following properties: mode= {}, ip:port= {}:{}",
191                 connectionType, addressStr, portStr);
192         if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
193             if (addressStr == null) {
194                 fail(usage());
195             }
196         }
197     }
198
199     @Before
200     @Override
201     public void setup() {
202         if (setup.get()) {
203             LOG.info("Skipping setUp, already initialized");
204             return;
205         }
206
207         try {
208             Thread.sleep(1000);
209             super.setup();
210         } catch (Exception e) {
211             e.printStackTrace();
212         }
213
214         getProperties();
215
216         dataBroker = getDatabroker(getProviderContext());
217         mdsalUtils = new MdsalUtils(dataBroker);
218         assertNotNull("mdsalUtils should not be null", mdsalUtils);
219         southboundUtils = new SouthboundUtils(mdsalUtils);
220         assertTrue("Did not find " + NETVIRT_TOPOLOGY_ID, getNetvirtTopology());
221         southbound = (Southbound) ServiceHelper.getGlobalInstance(Southbound.class, this);
222         assertNotNull("southbound should not be null", southbound);
223         setup.set(true);
224     }
225
226     private ProviderContext getProviderContext() {
227         ProviderContext providerContext = null;
228         for (int i=0; i < 60; i++) {
229             providerContext = getSession();
230             if (providerContext != null) {
231                 break;
232             } else {
233                 try {
234                     Thread.sleep(1000);
235                 } catch (InterruptedException e) {
236                     e.printStackTrace();
237                 }
238             }
239         }
240         assertNotNull("providercontext should not be null", providerContext);
241         /* One more second to let the provider finish initialization */
242         try {
243             Thread.sleep(1000);
244         } catch (InterruptedException e) {
245             e.printStackTrace();
246         }
247         return providerContext;
248     }
249
250     private DataBroker getDatabroker(ProviderContext providerContext) {
251         DataBroker dataBroker = providerContext.getSALService(DataBroker.class);
252         assertNotNull("dataBroker should not be null", dataBroker);
253         return dataBroker;
254     }
255
256     private Boolean getNetvirtTopology() {
257         LOG.info("getNetvirtTopology: looking for {}...", NETVIRT_TOPOLOGY_ID);
258         Boolean found = false;
259         final TopologyId topologyId = new TopologyId(new Uri(NETVIRT_TOPOLOGY_ID));
260         InstanceIdentifier<Topology> path =
261                 InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(topologyId));
262         for (int i = 0; i < 60; i++) {
263             Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path);
264             if (topology != null) {
265                 LOG.info("getNetvirtTopology: found {}...", NETVIRT_TOPOLOGY_ID);
266                 found = true;
267                 break;
268             } else {
269                 LOG.info("getNetvirtTopology: still looking ({})...", i);
270                 try {
271                     Thread.sleep(1000);
272                 } catch (InterruptedException e) {
273                     e.printStackTrace();
274                 }
275             }
276         }
277         return found;
278     }
279
280     @Test
281     public void testNetvirtSfcFeatureLoad() {
282         assertTrue(true);
283     }
284
285     private AccessListsBuilder setAccessLists () {
286         MatchesBuilder matchesBuilder = aclUtils.createMatches(new MatchesBuilder(), 80);
287         ActionsBuilder actionsBuilder = aclUtils.createActions(new ActionsBuilder(), Boolean.TRUE);
288         AceBuilder accessListEntryBuilder = aclUtils.createAccessListEntryBuilder(
289                 new AceBuilder(), "http", matchesBuilder, actionsBuilder);
290         AccessListEntriesBuilder accessListEntriesBuilder = aclUtils.createAccessListEntries(
291                 new AccessListEntriesBuilder(), accessListEntryBuilder);
292         AclBuilder accessListBuilder = aclUtils.createAccessList(new AclBuilder(),
293                 "http", accessListEntriesBuilder);
294         AccessListsBuilder accessListsBuilder = aclUtils.createAccessLists(new AccessListsBuilder(),
295                 accessListBuilder);
296         LOG.info("AccessLists: {}", accessListsBuilder.build());
297         return accessListsBuilder;
298     }
299
300     @Test
301     public void testAccessLists() {
302         testModel(setAccessLists(), AccessLists.class);
303     }
304
305     private ClassifiersBuilder setClassifiers() {
306         SffBuilder sffBuilder = classifierUtils.createSff(new SffBuilder(), "sffname");
307         SffsBuilder sffsBuilder = classifierUtils.createSffs(new SffsBuilder(), sffBuilder);
308         ClassifierBuilder classifierBuilder = classifierUtils.createClassifier(new ClassifierBuilder(),
309                 "classifierName", "aclName", sffsBuilder);
310         ClassifiersBuilder classifiersBuilder = classifierUtils.createClassifiers(new ClassifiersBuilder(),
311                 classifierBuilder);
312         LOG.info("Classifiers: {}", classifiersBuilder.build());
313         return classifiersBuilder;
314     }
315
316     @Test
317     public void testClassifiers() {
318         testModel(setClassifiers(), Classifiers.class);
319     }
320
321     private SfcBuilder setSfc() {
322         return sfcUtils.createSfc(new SfcBuilder(), "sfc");
323     }
324
325     @Test
326     public void testSfc() {
327         testModel(setSfc(), Sfc.class);
328     }
329
330     private <T extends DataObject> void testModel(Builder<T> builder, Class<T> clazz) {
331         InstanceIdentifier<T> path = InstanceIdentifier.create(clazz);
332         assertTrue(mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, path, builder.build()));
333         T result = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, path);
334         assertNotNull(clazz.getSimpleName() + " should not be null", result);
335         assertTrue("Failed to remove " + clazz.getSimpleName(),
336                 mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, path));
337         result = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, path);
338         assertNull(clazz.getSimpleName() + " should be null", result);
339     }
340
341     /*
342      * Connect to an ovsdb node. Netvirt should add br-int, add the controller address
343      * and program the pipeline flows.
344      */
345     @Test
346     public void testDoIt() throws InterruptedException {
347         String bridgeName = INTEGRATION_BRIDGE_NAME;
348         ConnectionInfo connectionInfo = southboundUtils.getConnectionInfo(addressStr, portStr);
349         assertNotNull("connection failed", southboundUtils.connectOvsdbNode(connectionInfo));
350         Node ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
351         assertNotNull("node is not connected", ovsdbNode);
352         ControllerEntry controllerEntry;
353         // Loop 10s checking if the controller was added
354         for (int i = 0; i < 10; i++) {
355             ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
356             assertNotNull("ovsdb node not found", ovsdbNode);
357             String controllerTarget = "tcp:192.168.50.1:6653";//SouthboundUtil.getControllerTarget(ovsdbNode);
358             assertNotNull("Failed to get controller target", controllerTarget);
359             OvsdbBridgeAugmentation bridge = southboundUtils.getBridge(connectionInfo, bridgeName);
360             assertNotNull(bridge);
361             assertNotNull(bridge.getControllerEntry());
362             controllerEntry = bridge.getControllerEntry().iterator().next();
363             assertEquals(controllerTarget, controllerEntry.getTarget().getValue());
364             if (controllerEntry.isIsConnected()) {
365                 Assert.assertTrue(controllerEntry.isIsConnected());
366                 break;
367             }
368             Thread.sleep(1000);
369         }
370
371         /* TODO: add code to write to mdsal to exercise the sfc dataChangeListener */
372         /* allow some time to let the impl code do it's work to push flows */
373         /* or just comment out below lines and just manually verify on the bridges and reset them */
374         //Thread.sleep(10000);
375
376         assertTrue(southboundUtils.deleteBridge(connectionInfo, bridgeName));
377         Thread.sleep(1000);
378         assertTrue(southboundUtils.disconnectOvsdbNode(connectionInfo));
379     }
380
381     @Test
382     public void testDemo() throws InterruptedException {
383         for (DemoVm vm : demoVms){
384             ConnectionInfo connectionInfo = southboundUtils.getConnectionInfo(vm.ipAddr, vm.ipPort);
385             assertNotNull("connection failed", southboundUtils.connectOvsdbNode(connectionInfo));
386             Node ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
387             assertNotNull("node is not connected", ovsdbNode);
388             String controllerTarget = SouthboundUtil.getControllerTarget(ovsdbNode);
389             assertNotNull("Failed to get controller target", controllerTarget);
390             List<ControllerEntry> setControllerEntry = southboundUtils.createControllerEntry(controllerTarget);
391             Uri setUri = new Uri(controllerTarget);
392             assertTrue(southboundUtils.addBridge(connectionInfo, null, vm.name, null, true,
393                     SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null,
394                     setControllerEntry, null));
395
396             for (int i = 0; i < 10; i++) {
397                 OvsdbBridgeAugmentation bridge = southboundUtils.getBridge(connectionInfo, vm.name);
398                 assertNotNull("bridge was not found: " + vm.name, bridge);
399                 assertNotNull("ControllerEntry was not found: "
400                                 + southboundUtils.createControllerEntry(controllerTarget),
401                         bridge.getControllerEntry());
402                 List<ControllerEntry> getControllerEntries = bridge.getControllerEntry();
403                 for (ControllerEntry entry : getControllerEntries) {
404                     if (entry.isIsConnected()) {
405                         assertTrue(entry.isIsConnected());
406                         break;
407                     }
408                 }
409                 Thread.sleep(1000);
410             }
411
412             assertTrue(southboundUtils.deleteBridge(connectionInfo, vm.name));
413             Thread.sleep(1000);
414             assertTrue(southboundUtils.disconnectOvsdbNode(connectionInfo));
415         }
416     }
417
418     private class DemoVm {
419         String name;
420         String ipAddr;
421         String ipPort;
422
423         DemoVm(String name, String ipAddr, String ipPort) {
424             this.name = name;
425             this.ipAddr = ipAddr;
426             this.ipPort = ipPort;
427         }
428     }
429
430     private DemoVm[] demoVms = {
431             new DemoVm("sw1", "192.168.50.70", "6640"),
432             //new DemoVm("sw2", "192.168.50.71", "6640"),
433     };
434
435     @Test
436     public void testDoIt2() throws InterruptedException {
437         String bridgeName = "sw1";
438         ConnectionInfo connectionInfo = southboundUtils.getConnectionInfo(addressStr, portStr);
439         assertNotNull("connection failed", southboundUtils.connectOvsdbNode(connectionInfo));
440         Node ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
441         assertNotNull("node is not connected", ovsdbNode);
442         String controllerTarget = "tcp:192.168.50.1:6653";
443         List<ControllerEntry> setControllerEntry = southboundUtils.createControllerEntry(controllerTarget);
444         Assert.assertTrue(southboundUtils.addBridge(connectionInfo, null, bridgeName, null, true,
445                 SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null,
446                 setControllerEntry, null, "00:00:00:00:00:00:00:01"));
447         // Loop 10s checking if the controller was added
448         for (int i = 0; i < 10; i++) {
449             ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
450             assertNotNull("ovsdb node not found", ovsdbNode);
451             assertNotNull("Failed to get controller target", controllerTarget);
452             OvsdbBridgeAugmentation bridge = southboundUtils.getBridge(connectionInfo, bridgeName);
453             assertNotNull(bridge);
454             assertNotNull(bridge.getControllerEntry());
455             ControllerEntry controllerEntry = bridge.getControllerEntry().iterator().next();
456             assertEquals(controllerTarget, controllerEntry.getTarget().getValue());
457             if (controllerEntry.isIsConnected()) {
458                 Assert.assertTrue(controllerEntry.isIsConnected());
459                 break;
460             }
461             Thread.sleep(1000);
462         }
463
464         SfcClassifier sfcClassifier = new SfcClassifier(dataBroker, southbound, mdsalUtils);
465         Node bridgeNode = southbound.getBridgeNode(ovsdbNode, bridgeName);
466         assertNotNull("bridge " + bridgeName + " was not found", bridgeNode);
467         long datapathId = southbound.getDataPathId(bridgeNode);
468         //sfcClassifier.programSfcClassiferFlows();
469         sfcClassifier.programLocalInPort(datapathId, "4096", (long)1, (short)0, (short)50, true);
470
471         NshUtils nshUtils = new NshUtils(new Ipv4Address("192.168.50.71"), new PortNumber(6633),
472                 (long)10, (short)255, (long)4096, (long)4096);
473         MatchesBuilder matchesBuilder = aclUtils.createMatches(new MatchesBuilder(), 80);
474         sfcClassifier.programSfcClassiferFlows(datapathId, (short)50, "test", matchesBuilder.build(),
475                 nshUtils, (long)2, true);
476
477         //try {
478         //    System.in.read();
479         //} catch (IOException e) {
480         //    e.printStackTrace();
481         //}
482
483         Thread.sleep(15000);
484         assertTrue(southboundUtils.deleteBridge(connectionInfo, bridgeName));
485         Thread.sleep(1000);
486         assertTrue(southboundUtils.deleteBridge(connectionInfo, INTEGRATION_BRIDGE_NAME));
487         Thread.sleep(1000);
488         assertTrue(southboundUtils.disconnectOvsdbNode(connectionInfo));
489     }
490 }