This repository has been archived by the owner on Jul 13, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Neutron (fully working & tested)
- Loading branch information
Showing
7 changed files
with
195 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
src/main/java/org/opendaylight/neutron/simple/NeutronModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
* Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.opendaylight.neutron.simple; | ||
|
||
import com.google.inject.AbstractModule; | ||
import org.opendaylight.neutron.northbound.api.WebInitializer; | ||
import org.opendaylight.neutron.spi.INeutronBgpvpnCRUD; | ||
import org.opendaylight.neutron.spi.INeutronFirewallCRUD; | ||
import org.opendaylight.neutron.spi.INeutronFirewallPolicyCRUD; | ||
import org.opendaylight.neutron.spi.INeutronFirewallRuleCRUD; | ||
import org.opendaylight.neutron.spi.INeutronFloatingIpCRUD; | ||
import org.opendaylight.neutron.spi.INeutronL2gatewayCRUD; | ||
import org.opendaylight.neutron.spi.INeutronL2gatewayConnectionCRUD; | ||
import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD; | ||
import org.opendaylight.neutron.spi.INeutronLoadBalancerHealthMonitorCRUD; | ||
import org.opendaylight.neutron.spi.INeutronLoadBalancerListenerCRUD; | ||
import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD; | ||
import org.opendaylight.neutron.spi.INeutronMeteringLabelCRUD; | ||
import org.opendaylight.neutron.spi.INeutronMeteringLabelRuleCRUD; | ||
import org.opendaylight.neutron.spi.INeutronNetworkCRUD; | ||
import org.opendaylight.neutron.spi.INeutronPortCRUD; | ||
import org.opendaylight.neutron.spi.INeutronQosPolicyCRUD; | ||
import org.opendaylight.neutron.spi.INeutronRouterCRUD; | ||
import org.opendaylight.neutron.spi.INeutronSFCFlowClassifierCRUD; | ||
import org.opendaylight.neutron.spi.INeutronSFCPortChainCRUD; | ||
import org.opendaylight.neutron.spi.INeutronSFCPortPairCRUD; | ||
import org.opendaylight.neutron.spi.INeutronSFCPortPairGroupCRUD; | ||
import org.opendaylight.neutron.spi.INeutronSecurityGroupCRUD; | ||
import org.opendaylight.neutron.spi.INeutronSecurityRuleCRUD; | ||
import org.opendaylight.neutron.spi.INeutronSubnetCRUD; | ||
import org.opendaylight.neutron.spi.INeutronTapFlowCRUD; | ||
import org.opendaylight.neutron.spi.INeutronTapServiceCRUD; | ||
import org.opendaylight.neutron.spi.INeutronTrunkCRUD; | ||
import org.opendaylight.neutron.spi.INeutronVpnIkePolicyCRUD; | ||
import org.opendaylight.neutron.spi.INeutronVpnIpSecPolicyCRUD; | ||
import org.opendaylight.neutron.spi.INeutronVpnIpSecSiteConnectionsCRUD; | ||
import org.opendaylight.neutron.spi.INeutronVpnServiceCRUD; | ||
import org.opendaylight.neutron.transcriber.NeutronBgpvpnInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronFirewallInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronFirewallPolicyInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronFirewallRuleInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronFloatingIpInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronL2gatewayConnectionInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronL2gatewayInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronLoadBalancerHealthMonitorInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronLoadBalancerInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronLoadBalancerListenerInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronLoadBalancerPoolInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronMeteringLabelInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronMeteringLabelRuleInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronNetworkInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronPortInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronQosPolicyInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronRouterInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronSFCFlowClassifierInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronSFCPortChainInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronSFCPortPairGroupInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronSFCPortPairInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronSecurityGroupInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronSecurityRuleInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronSubnetInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronTapFlowInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronTapServiceInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronTrunkInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronVpnIkePolicyInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronVpnIpSecPolicyInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronVpnIpSecSiteConnectionsInterface; | ||
import org.opendaylight.neutron.transcriber.NeutronVpnServiceInterface; | ||
import org.ops4j.pax.cdi.api.OsgiService; | ||
|
||
/** | ||
* Guice module for Neutron. | ||
* | ||
* @author Michael Vorburger.ch | ||
*/ | ||
public class NeutronModule extends AbstractModule { | ||
|
||
@Override | ||
protected void configure() { | ||
bind(WebInitializer.class); | ||
|
||
// The following is currently copy/pasted from | ||
// org.opendaylight.neutron.e2etest.NeutronTestWiring | ||
// but likely will get replaced with automated classpath scanning anyway later | ||
// (strangely though it needs .annotatedWith(OsgiService.class) everywhere, only here) | ||
bind(INeutronNetworkCRUD.class).annotatedWith(OsgiService.class).to(NeutronNetworkInterface.class); | ||
bind(INeutronSubnetCRUD.class).annotatedWith(OsgiService.class).to(NeutronSubnetInterface.class); | ||
bind(INeutronPortCRUD.class).annotatedWith(OsgiService.class).to(NeutronPortInterface.class); | ||
bind(INeutronRouterCRUD.class).annotatedWith(OsgiService.class).to(NeutronRouterInterface.class); | ||
bind(INeutronFloatingIpCRUD.class).annotatedWith(OsgiService.class).to(NeutronFloatingIpInterface.class); | ||
bind(INeutronSecurityGroupCRUD.class).annotatedWith(OsgiService.class).to(NeutronSecurityGroupInterface.class); | ||
bind(INeutronSecurityRuleCRUD.class).annotatedWith(OsgiService.class).to(NeutronSecurityRuleInterface.class); | ||
bind(INeutronFirewallCRUD.class).annotatedWith(OsgiService.class).to(NeutronFirewallInterface.class); | ||
bind(INeutronFirewallPolicyCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronFirewallPolicyInterface.class); | ||
bind(INeutronFirewallRuleCRUD.class).annotatedWith(OsgiService.class).to(NeutronFirewallRuleInterface.class); | ||
bind(INeutronLoadBalancerCRUD.class).annotatedWith(OsgiService.class).to(NeutronLoadBalancerInterface.class); | ||
bind(INeutronLoadBalancerListenerCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronLoadBalancerListenerInterface.class); | ||
bind(INeutronLoadBalancerPoolCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronLoadBalancerPoolInterface.class); | ||
bind(INeutronBgpvpnCRUD.class).annotatedWith(OsgiService.class).to(NeutronBgpvpnInterface.class); | ||
bind(INeutronL2gatewayCRUD.class).annotatedWith(OsgiService.class).to(NeutronL2gatewayInterface.class); | ||
bind(INeutronL2gatewayConnectionCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronL2gatewayConnectionInterface.class); | ||
bind(INeutronLoadBalancerHealthMonitorCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronLoadBalancerHealthMonitorInterface.class); | ||
bind(INeutronMeteringLabelCRUD.class).annotatedWith(OsgiService.class).to(NeutronMeteringLabelInterface.class); | ||
bind(INeutronMeteringLabelRuleCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronMeteringLabelRuleInterface.class); | ||
bind(INeutronVpnServiceCRUD.class).annotatedWith(OsgiService.class).to(NeutronVpnServiceInterface.class); | ||
bind(INeutronVpnIkePolicyCRUD.class).annotatedWith(OsgiService.class).to(NeutronVpnIkePolicyInterface.class); | ||
bind(INeutronVpnIpSecPolicyCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronVpnIpSecPolicyInterface.class); | ||
bind(INeutronSFCFlowClassifierCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronSFCFlowClassifierInterface.class); | ||
bind(INeutronSFCPortChainCRUD.class).annotatedWith(OsgiService.class).to(NeutronSFCPortChainInterface.class); | ||
bind(INeutronSFCPortPairGroupCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronSFCPortPairGroupInterface.class); | ||
bind(INeutronSFCPortPairCRUD.class).annotatedWith(OsgiService.class).to(NeutronSFCPortPairInterface.class); | ||
bind(INeutronQosPolicyCRUD.class).annotatedWith(OsgiService.class).to(NeutronQosPolicyInterface.class); | ||
bind(INeutronTrunkCRUD.class).annotatedWith(OsgiService.class).to(NeutronTrunkInterface.class); | ||
bind(INeutronTapServiceCRUD.class).annotatedWith(OsgiService.class).to(NeutronTapServiceInterface.class); | ||
bind(INeutronTapFlowCRUD.class).annotatedWith(OsgiService.class).to(NeutronTapFlowInterface.class); | ||
bind(INeutronVpnIpSecSiteConnectionsCRUD.class).annotatedWith(OsgiService.class) | ||
.to(NeutronVpnIpSecSiteConnectionsInterface.class); | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
src/main/java/org/opendaylight/neutron/simple/NeutronWiring.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
src/test/java/org/opendaylight/neutron/simple/test/NeutronModuleTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.opendaylight.neutron.simple.test; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
import static org.opendaylight.infrautils.testutils.TestHttpClient.Method.GET; | ||
|
||
import java.io.IOException; | ||
import javax.inject.Inject; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.opendaylight.aaa.web.WebServer; | ||
import org.opendaylight.controller.simple.ControllerWiring; | ||
import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule; | ||
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2; | ||
import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest; | ||
import org.opendaylight.infrautils.testutils.TestHttpClient; | ||
import org.opendaylight.infrautils.web.WebWiring; | ||
import org.opendaylight.neutron.simple.NeutronModule; | ||
|
||
/** | ||
* Neutron component test. | ||
* | ||
* @author Michael Vorburger.ch | ||
*/ | ||
public class NeutronModuleTest extends AbstractSimpleDistributionTest { | ||
|
||
public @Rule GuiceRule2 guice = new GuiceRule2( | ||
NeutronModule.class, ControllerWiring.class, WebWiring.class, AnnotationsModule.class); | ||
|
||
@Inject WebServer webServer; | ||
@Inject TestHttpClient http; | ||
|
||
@Test public void testNeutron() throws IOException { | ||
assertThat(http.responseCode(GET, "/controller/nb/v2/neutron/networks")).isEqualTo(200); | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
src/test/java/org/opendaylight/neutron/simple/test/NeutronSimpleDistributionTest.java
This file was deleted.
Oops, something went wrong.