+
+ @Test
+ public void testDoIt2() throws InterruptedException {
+ String bridgeName = "sw1";
+ ConnectionInfo connectionInfo = southboundUtils.getConnectionInfo(addressStr, portStr);
+ assertNotNull("connection failed", southboundUtils.connectOvsdbNode(connectionInfo));
+ Node ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
+ assertNotNull("node is not connected", ovsdbNode);
+ String controllerTarget = "tcp:192.168.50.1:6653";
+ List<ControllerEntry> setControllerEntry = southboundUtils.createControllerEntry(controllerTarget);
+ Assert.assertTrue(southboundUtils.addBridge(connectionInfo, null, bridgeName, null, true,
+ SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null,
+ setControllerEntry, null, "00:00:00:00:00:00:00:01"));
+ // Loop 10s checking if the controller was added
+ for (int i = 0; i < 10; i++) {
+ ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
+ assertNotNull("ovsdb node not found", ovsdbNode);
+ assertNotNull("Failed to get controller target", controllerTarget);
+ OvsdbBridgeAugmentation bridge = southboundUtils.getBridge(connectionInfo, bridgeName);
+ assertNotNull(bridge);
+ assertNotNull(bridge.getControllerEntry());
+ ControllerEntry controllerEntry = bridge.getControllerEntry().iterator().next();
+ assertEquals(controllerTarget, controllerEntry.getTarget().getValue());
+ if (controllerEntry.isIsConnected()) {
+ Assert.assertTrue(controllerEntry.isIsConnected());
+ break;
+ }
+ Thread.sleep(1000);
+ }
+
+ SfcClassifier sfcClassifier = new SfcClassifier(dataBroker, southbound, mdsalUtils);
+ Node bridgeNode = southbound.getBridgeNode(ovsdbNode, bridgeName);
+ assertNotNull("bridge " + bridgeName + " was not found", bridgeNode);
+ long datapathId = southbound.getDataPathId(bridgeNode);
+ //sfcClassifier.programSfcClassiferFlows();
+ sfcClassifier.programLocalInPort(datapathId, "4096", (long)1, (short)0, (short)50, true);
+
+ NshUtils nshUtils = new NshUtils(new Ipv4Address("192.168.50.71"), new PortNumber(6633),
+ (long)10, (short)255, (long)4096, (long)4096);
+ MatchesBuilder matchesBuilder = aclUtils.createMatches(new MatchesBuilder(), 80);
+ sfcClassifier.programSfcClassiferFlows(datapathId, (short)50, "test", matchesBuilder.build(),
+ nshUtils, (long)2, true);
+
+ //try {
+ // System.in.read();
+ //} catch (IOException e) {
+ // e.printStackTrace();
+ //}
+
+ Thread.sleep(15000);
+ assertTrue(southboundUtils.deleteBridge(connectionInfo, bridgeName));
+ Thread.sleep(1000);
+ assertTrue(southboundUtils.deleteBridge(connectionInfo, INTEGRATION_BRIDGE_NAME));
+ Thread.sleep(1000);
+ assertTrue(southboundUtils.disconnectOvsdbNode(connectionInfo));
+ }