Openflowjava-util rename reflecting change
[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 static org.ops4j.pax.exam.CoreOptions.mavenBundle;
13
14 import org.opendaylight.controller.test.sal.binding.it.TestHelper;
15 import org.ops4j.pax.exam.CoreOptions;
16 import org.ops4j.pax.exam.Option;
17 import org.ops4j.pax.exam.options.DefaultCompositeOption;
18
19 /**
20  * The main wiring is assembled in {@link #ofPluginBundles()}
21  * @author mirehak
22  */
23 public abstract class OFPaxOptionsAssistant {
24
25     /** system property required to enable osgi console and remote debugging, only presence matters */
26     private static final String INSPECT_OSGI = "inspectOsgi";
27     /** default remote debug port */
28     public static final String DEBUG_PORT = "6000";
29     /** base controller package */
30     public static final String CONTROLLER = "org.opendaylight.controller";
31     /** base controller md-sal package */
32     public static final String CONTROLLER_MD = "org.opendaylight.controller.md";
33     /** OFLibrary package */
34     public static final String OFLIBRARY = "org.opendaylight.openflowjava";
35     /** OFPlugin package */
36     public static final String OFPLUGIN = "org.opendaylight.openflowplugin";
37     /** OFPlugin applications package */
38     public static final String OFPLUGIN_APPS = "org.opendaylight.openflowplugin.applications";
39     /** OFPlugin model package */
40     public static final String OFPLUGIN_MODEL = "org.opendaylight.openflowplugin.model";
41     /** controller.model package */
42     public static final String CONTROLLER_MODEL = "org.opendaylight.controller.model";
43
44     public static final String YANGTOOLS = "org.opendaylight.yangtools";
45
46
47     /**
48      * Works only if property -DinspectOsgi is used
49      * @return equinox console setup (in order to inspect running IT through osgi console (telnet))
50      * and remote debugging on port {@link #DEBUG_PORT}
51      */
52     public static Option osgiConsoleBundles() {
53         DefaultCompositeOption option = new DefaultCompositeOption();
54         if (System.getProperty(INSPECT_OSGI) != null) {
55             option
56             .add(CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address="+DEBUG_PORT))
57             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject())
58             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject())
59             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject())
60             .add(CoreOptions.mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject());
61         }
62
63         return option;
64     }
65
66     /**
67      * @return OFLibrary bundles
68      */
69     public static Option ofLibraryBundles() {
70         return new DefaultCompositeOption(
71                 mavenBundle(OFLIBRARY, "openflowjava-util").versionAsInProject(),
72                 mavenBundle(OFLIBRARY, "openflow-protocol-impl").versionAsInProject(),
73                 mavenBundle(OFLIBRARY, "openflow-protocol-api").versionAsInProject(),
74                 mavenBundle(OFLIBRARY, "openflow-protocol-spi").versionAsInProject(),
75                 mavenBundle(OFLIBRARY, "simple-client").versionAsInProject().start());
76     }
77
78     /**
79      * Here we construct whole wiring
80      * @return OFLibrary + OFPlugin bundles
81      */
82     public static Option ofPluginBundles() {
83         return new DefaultCompositeOption(
84                 baseSalBundles(),
85                 mdSalApiBundles(),
86                 mdSalImplBundles(),
87                 mdSalBaseModelBundles(),
88                 ofLibraryBundles(),
89                 mavenBundle(CONTROLLER_MODEL, "model-inventory").versionAsInProject(),
90                 mavenBundle(OFPLUGIN_MODEL, "model-flow-statistics").versionAsInProject(),
91                 mavenBundle(OFPLUGIN_MODEL, "model-flow-base").versionAsInProject(),
92                 mavenBundle(OFPLUGIN_MODEL, "model-flow-service").versionAsInProject(),
93                 mavenBundle(OFPLUGIN, "openflowplugin-common").versionAsInProject(),
94                 mavenBundle(OFPLUGIN, "openflowplugin-api").versionAsInProject(),
95                 mavenBundle(OFPLUGIN, "openflowplugin-extension-api").versionAsInProject(),
96                 mavenBundle(OFPLUGIN, "openflowplugin").versionAsInProject(),
97                 mavenBundle(OFPLUGIN_APPS, "forwardingrules-manager").versionAsInProject(),
98                 mavenBundle(OFPLUGIN_APPS, "inventory-manager").versionAsInProject(),
99                 mavenBundle("openexi", "nagasena").versionAsInProject()
100                 );
101     }
102
103     /**
104      * @return logging bundles
105      */
106     public static Option loggingBudles() {
107         return new DefaultCompositeOption(
108                 mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
109                 mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
110                 mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),
111                 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject());
112     }
113
114     /**
115      * @return sal + dependencymanager
116      */
117     public static Option baseSalBundles() {
118         return new DefaultCompositeOption(
119 //                mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
120 //                mavenBundle(CONTROLLER, "sal").versionAsInProject(),
121                 mavenBundle("io.netty", "netty-common").versionAsInProject(), //
122                 mavenBundle("io.netty", "netty-buffer").versionAsInProject(), //
123                 mavenBundle("io.netty", "netty-handler").versionAsInProject(), //
124                 mavenBundle("io.netty", "netty-codec").versionAsInProject(), //
125                 mavenBundle("io.netty", "netty-transport").versionAsInProject(), //
126
127                 mavenBundle(CONTROLLER, "liblldp").versionAsInProject(),
128                 mavenBundle(OFPLUGIN_APPS, "topology-lldp-discovery").versionAsInProject(),
129                 mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject());
130     }
131
132     /**
133      * @return sal + dependencymanager
134      */
135     public static Option mdSalApiBundles() {
136         return new DefaultCompositeOption(
137                 TestHelper.junitAndMockitoBundles(),
138                 TestHelper.mdSalCoreBundles(),
139                 TestHelper.configMinumumBundles(),
140                 mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject());
141     }
142
143     private static Option mdSalImplBundles() {
144         return new DefaultCompositeOption(
145                 TestHelper.bindingAwareSalBundles()
146         );
147     }
148
149     private static Option mdSalBaseModelBundles() {
150         return new DefaultCompositeOption(
151                 TestHelper.baseModelBundles(),
152                 mavenBundle(CONTROLLER_MODEL, "model-inventory").versionAsInProject()
153         );
154     }
155
156 }