Added the missing Copyright headers to most of the java files.
[netvirt.git] / ovsdb / src / test / java / org / opendaylight / ovsdb / plugin / OvsdbTestDeletePortIT.java
1 /*
2  * [[ Authors will Fill in the Copyright header ]]
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  * Authors : Brent Salisbury, Hugo Trippaers
9  */
10 package org.opendaylight.ovsdb.plugin;
11
12 import org.junit.Test;
13 import org.opendaylight.controller.sal.core.Node;
14 import org.opendaylight.controller.sal.core.NodeConnector;
15 import org.opendaylight.ovsdb.plugin.ConfigurationService;
16 import org.opendaylight.ovsdb.plugin.ConnectionService;
17 import org.opendaylight.controller.sal.connection.ConnectionConstants;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 public class OvsdbTestDeletePortIT {
25     private static final Logger logger = LoggerFactory
26             .getLogger(OvsdbTestAddPortIT.class);
27
28     @Test
29     public void deletePort() throws Throwable{
30         Node.NodeIDType.registerIDType("OVS", String.class);
31         NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
32
33         ConnectionService connectionService = new ConnectionService();
34         connectionService.init();
35         String identifier = "TEST";
36         Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
37         params.put(ConnectionConstants.ADDRESS, "10.12.0.78");
38         params.put(ConnectionConstants.PORT, "6634");
39
40         Node node = connectionService.connect(identifier, params);
41         if(node == null){
42             logger.error("Could not connect to ovsdb server");
43             return;
44         }
45         /**
46          * Deletes an existing port from an existing bridge
47          * Ex. ovs-vsctl del-port ovsbr0 tap0
48          * @param node Node serving this configuration service
49          * @param bridgeDomainIdentifier String representation of a Bridge Domain
50          * @param portIdentifier String representation of a user defined Port Name
51          */
52         ConfigurationService configurationService = new ConfigurationService();
53         configurationService.setConnectionServiceInternal(connectionService);
54         configurationService.deletePort(node, "ovsbr0", "tap2");
55     }
56 }