2 * [[ Authors will Fill in the Copyright header ]]
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
8 * Authors : Brent Salisbury, Hugo Trippaers
10 package org.opendaylight.ovsdb.plugin;
13 import java.util.HashMap;
16 import org.junit.Test;
17 import org.opendaylight.controller.sal.core.Node;
18 import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class OvsdbTestAddTunnelIT extends OvsdbTestBase {
23 private static final Logger logger = LoggerFactory
24 .getLogger(OvsdbTestAddTunnelIT.class);
27 public void addTunnel() throws Throwable{
28 TestObjects testObjects = getTestConnection();
29 ConnectionService connectionService = testObjects.connectionService;
30 Node node = testObjects.node;
33 * tunnelendpoint IP address of the
34 * destination Tunnel Endpoint.
35 * tunencap is the tunnel encapsulation
36 * options being (CAPWAP, GRE, VXLAN).
37 * Use the following lines to test GRE and CAPWAP
38 * Encapsulation encap = Encapsulation.GRE;
39 * Encapsulation encap = Encapsulation.CAPWAP;
42 Encapsulation encap = Encapsulation.VXLAN;
43 String tunencap = encap.toString();
44 String tunnelendpoint = FAKE_IP;
47 * Create an Encapsulated Tunnel Interface and destination Tunnel Endpoint
49 * Ex. ovs-vsctl add-port br0 vxlan1 (cont)
50 * -- set interface vxlan1 type=vxlan options:remote_ip=192.168.1.11
51 * @param node Node serving this configuration service
52 * @param bridgeDomainIdentifier String representation of a Bridge Domain
53 * @param portIdentifier String representation of a user defined Port Name
54 * @param tunnelendpoint IP address of the destination Tunnel Endpoint
55 * @param tunencap is the tunnel encapsulation options being CAPWAP, GRE or VXLAN
56 * The Bridge must already be defined before calling addTunnel.
58 ConfigurationService configurationService = new ConfigurationService();
59 configurationService.setConnectionServiceInternal(connectionService);
60 Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
61 configs.put(ConfigConstants.TYPE, "TUNNEL");
62 configs.put(ConfigConstants.TUNNEL_TYPE, tunencap);
63 configs.put(ConfigConstants.DEST_IP, tunnelendpoint);
65 configurationService.addPort(node, BRIDGE_NAME, TUNNEL_PORT_NAME, configs);