BUG-2242: LLDP speaker as separate application.
[openflowplugin.git] / openflowplugin-it / src / test / java / org / opendaylight / openflowplugin / openflow / md / it / OFPaxOptionsAssistant.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, 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.openflowplugin.openflow.md.it;
10
11
12 import org.ops4j.pax.exam.CoreOptions;
13 import org.ops4j.pax.exam.Option;
14 import org.ops4j.pax.exam.options.DefaultCompositeOption;
15
16 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
17
18 /**
19  * @author mirehak
20  *
21  */
22 public abstract class OFPaxOptionsAssistant {
23
24     /** system property required to enable osgi console and remote debugging, only presence matters */
25     private static final String INSPECT_OSGI = "inspectOsgi";
26     /** default remote debug port */
27     public static final String DEBUG_PORT = "6000";
28     /** base controller package */
29     public static final String CONTROLLER = "org.opendaylight.controller";
30     /** OFLibrary package */
31     public static final String OFLIBRARY = "org.opendaylight.openflowjava";
32     /** OFLibrary package */
33     public static final String OFPLUGIN = "org.opendaylight.openflowplugin";
34     /** controller.model package */
35     public static final String CONTROLLER_MODEL = "org.opendaylight.controller.model";
36
37     public static final String YANGTOOLS = "org.opendaylight.yangtools";
38
39
40     /**
41      * Works only if property -DinspectOsgi is used
42      * @return equinox console setup (in order to inspect running IT through osgi console (telnet))
43      * and remote debugging on port {@link #DEBUG_PORT}
44      */
45     public static Option osgiConsoleBundles() {
46         DefaultCompositeOption option = new DefaultCompositeOption();
47         if (System.getProperty(INSPECT_OSGI) != null) {
48             option
49             .add(CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address="+DEBUG_PORT))
50             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject())
51             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject())
52             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject())
53             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject());
54         }
55
56         return option;
57     }
58
59     /**
60      * @return OFLibrary bundles
61      */
62     public static Option ofLibraryBundles() {
63         return new DefaultCompositeOption(
64                 mavenBundle(OFLIBRARY, "util").versionAsInProject(),
65                 mavenBundle(OFLIBRARY, "openflow-protocol-impl").versionAsInProject(),
66                 mavenBundle(OFLIBRARY, "openflow-protocol-api").versionAsInProject(),
67                 mavenBundle(OFLIBRARY, "openflow-protocol-spi").versionAsInProject(),
68                 mavenBundle(OFLIBRARY, "simple-client").versionAsInProject().start());
69     }
70
71     /**
72      * @return OFLibrary + OFPlugin bundles
73      */
74     public static Option ofPluginBundles() {
75         return new DefaultCompositeOption(
76                 baseSalBundles(),
77                 ofLibraryBundles(),
78                 mavenBundle(CONTROLLER_MODEL, "model-flow-statistics").versionAsInProject(),
79                 mavenBundle(OFPLUGIN, "openflowplugin-api").versionAsInProject(),
80                 mavenBundle(OFPLUGIN, "openflowplugin-extension-api").versionAsInProject(),
81                 mavenBundle(OFPLUGIN, "openflowplugin").versionAsInProject(),
82                 mavenBundle("org.openexi", "nagasena").versionAsInProject()
83                 );
84     }
85
86     /**
87      * @return logging bundles
88      */
89     public static Option loggingBudles() {
90         return new DefaultCompositeOption(
91                 mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
92                 mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
93                 mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),
94                 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject());
95     }
96
97     /**
98      * @return sal + dependencymanager
99      */
100     public static Option baseSalBundles() {
101         return new DefaultCompositeOption(
102 //                mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
103 //                mavenBundle(CONTROLLER, "sal").versionAsInProject(),
104                 mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject());
105
106     }
107
108 }