1 package org.opendaylight.ovsdb;
4 import org.opendaylight.controller.sal.core.Node;
5 import org.opendaylight.controller.sal.core.NodeConnector;
6 import org.opendaylight.ovsdb.internal.ConfigurationService;
7 import org.opendaylight.ovsdb.internal.ConnectionService;
8 import org.opendaylight.ovsdb.sal.connection.ConnectionConstants;
9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory;
11 import java.util.HashMap;
14 public class OvsdbTestAddVlan {
15 private static final Logger logger = LoggerFactory
16 .getLogger(OvsdbTestAddVlan.class);
19 public void addPortVlan() throws Throwable{
20 Node.NodeIDType.registerIDType("OVS", String.class);
21 NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
23 ConnectionService connectionService = new ConnectionService();
24 connectionService.init();
25 String identifier = "TEST";
26 Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
27 params.put(ConnectionConstants.ADDRESS, "172.16.58.170");
30 Node node = connectionService.connect(identifier, params);
32 logger.error("Could not connect to ovsdb server");
36 * Create a Port with a user defined VLAN, and attach it to the specified bridge.
38 * Ex. ovs-vsctl add-port JUNIT_BRIDGE_TEST Jvlanvif0 tag=100
39 * @param node Node serving this configuration service
40 * @param bridgeDomainIdentifier String representation of a Bridge Domain
41 * @param portIdentifier String representation of a user defined Port Name
42 * @param vlanid Integer note: only one VID is accepted with tag=x method
44 ConfigurationService configurationService = new ConfigurationService();
45 configurationService.setConnectionServiceInternal(connectionService);
46 configurationService.addPortVlan(node, "JUNIT_BRIDGE_TEST", "Jtagvif0", vlanid);