diff options
author | 2017-05-18 16:46:46 +0200 | |
---|---|---|
committer | 2017-05-29 08:36:30 +0200 | |
commit | 685bffccd16d58fc5c1dd5c118ee74aa39effa68 (patch) | |
tree | a9e9dd8277e818d6bb3c6ced7ad5ae74bab3c07c /infra/minimal-distribution/src/test | |
parent | 46589c652a58b1cd56dab268b59d96bc20b5dd1f (diff) |
HONEYCOMB-355: move BGP to separate distribution
Given current YangBindingProviderModule implementation (HONEYCOMB-358),
needed to preserve footprint of minimal distro.
The change also:
- reverts logger&persistence config changes
introduced by https://gerrit.fd.io/r/#/c/5972/
- improves logging for BGP component initialization
Change-Id: Ie223833518be21628edb7ace36c7618e427585e0
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/minimal-distribution/src/test')
3 files changed, 22 insertions, 151 deletions
diff --git a/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java b/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java index fdd265b79..ced29590b 100644 --- a/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java +++ b/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java @@ -18,7 +18,6 @@ package io.fd.honeycomb.infra.distro; import static com.google.common.collect.ImmutableSet.of; import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @@ -31,10 +30,6 @@ import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; -import io.fd.honeycomb.infra.distro.bgp.BgpExtensionsModule; -import io.fd.honeycomb.infra.distro.bgp.BgpModule; -import io.fd.honeycomb.infra.distro.bgp.BgpReadersModule; -import io.fd.honeycomb.infra.distro.bgp.BgpWritersModule; import io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule; import io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule; import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule; @@ -46,7 +41,6 @@ import io.fd.honeycomb.infra.distro.schema.SchemaModule; import io.fd.honeycomb.infra.distro.schema.YangBindingProviderModule; import java.io.IOException; import java.io.InputStream; -import java.net.InetAddress; import java.net.Socket; import java.util.Properties; import java.util.Set; @@ -75,36 +69,28 @@ public class BaseMinimalDistributionTest { private static final String NETCONF_NAMESPACE = "urn:ietf:params:xml:ns:netconf:base:1.0"; private static final int HELLO_WAIT = 2500; - private static final int BGP_MSG_TYPE_OFFSET = 18; // 16 (MARKER) + 2 (LENGTH); - private static final byte BGP_OPEN_MSG_TYPE = 1; - private static final int BGP_PORT = 1790; - public static final Set<Module> BASE_MODULES = of( - new YangBindingProviderModule(), - new SchemaModule(), - new ConfigAndOperationalPipelineModule(), - new ContextPipelineModule(), - new InitializerPipelineModule(), - new NetconfModule(), - new NetconfReadersModule(), - new RestconfModule(), - new BgpModule(), - new BgpExtensionsModule(), - new BgpReadersModule(), - new BgpWritersModule(), - new CfgAttrsModule()); + new YangBindingProviderModule(), + new SchemaModule(), + new ConfigAndOperationalPipelineModule(), + new ContextPipelineModule(), + new InitializerPipelineModule(), + new NetconfModule(), + new NetconfReadersModule(), + new RestconfModule(), + new CfgAttrsModule()); @Before public void setUp() throws Exception { SSLContext sslcontext = SSLContexts.custom() - .loadTrustMaterial(getClass().getResource("/honeycomb-keystore"), - CERT_PASSWORD.toCharArray(), new TrustSelfSignedStrategy()) - .build(); + .loadTrustMaterial(getClass().getResource("/honeycomb-keystore"), + CERT_PASSWORD.toCharArray(), new TrustSelfSignedStrategy()) + .build(); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext); CloseableHttpClient httpclient = HttpClients.custom() - .setSSLSocketFactory(sslsf) - .build(); + .setSSLSocketFactory(sslsf) + .build(); Unirest.setHttpClient(httpclient); } @@ -124,8 +110,6 @@ public class BaseMinimalDistributionTest { assertRestconfHttp(); LOG.info("Testing RESTCONF HTTPS"); assertRestconfHttps(); - LOG.info("Testing BGP"); - assertBgp(); } private void assertNetconfTcp() throws Exception { @@ -182,13 +166,13 @@ public class BaseMinimalDistributionTest { private void assertRestconfHttp() throws Exception { final String url = - "http://127.0.0.1:" + HTTP_PORT + "/restconf/operational/ietf-netconf-monitoring:netconf-state"; + "http://127.0.0.1:" + HTTP_PORT + "/restconf/operational/ietf-netconf-monitoring:netconf-state"; LOG.info("RESTCONF HTTP GET to {}", url); final HttpResponse<String> jsonNodeHttpResponse = Unirest.get(url) - .basicAuth(UNAME, PASSWORD) - .asString(); + .basicAuth(UNAME, PASSWORD) + .asString(); LOG.info("RESTCONF HTTP GET to {}, status: {}, data: {}", - url, jsonNodeHttpResponse.getStatus(), jsonNodeHttpResponse.getBody()); + url, jsonNodeHttpResponse.getStatus(), jsonNodeHttpResponse.getBody()); assertSuccessStatus(jsonNodeHttpResponse); assertSuccessResponseForNetconfMonitoring(jsonNodeHttpResponse); @@ -196,13 +180,13 @@ public class BaseMinimalDistributionTest { private void assertRestconfHttps() throws Exception { final String url = - "https://127.0.0.1:" + HTTPS_PORT + "/restconf/operational/ietf-netconf-monitoring:netconf-state"; + "https://127.0.0.1:" + HTTPS_PORT + "/restconf/operational/ietf-netconf-monitoring:netconf-state"; LOG.info("RESTCONF HTTPS GET to {}", url); final HttpResponse<String> jsonNodeHttpResponse = Unirest.get(url) - .basicAuth(UNAME, PASSWORD) - .asString(); + .basicAuth(UNAME, PASSWORD) + .asString(); LOG.info("RESTCONF HTTPS GET to {}, status: {}, data: {}", - url, jsonNodeHttpResponse.getStatus(), jsonNodeHttpResponse.getBody()); + url, jsonNodeHttpResponse.getStatus(), jsonNodeHttpResponse.getBody()); assertSuccessStatus(jsonNodeHttpResponse); assertSuccessResponseForNetconfMonitoring(jsonNodeHttpResponse); @@ -217,19 +201,4 @@ public class BaseMinimalDistributionTest { assertTrue(jsonNodeHttpResponse.getStatus() >= 200); assertTrue(jsonNodeHttpResponse.getStatus() < 400); } - - private void assertBgp() throws Exception { - final InetAddress bgpHost = InetAddress.getByName("127.0.0.1"); - final InetAddress bgpPeerAddress = InetAddress.getByName("127.0.0.2"); - try (final Socket localhost = new Socket(bgpHost, BGP_PORT, bgpPeerAddress, 0); - final InputStream inputStream = localhost.getInputStream()) { - // wait until bgp message is sent - Thread.sleep(HELLO_WAIT); - - final byte[] msg = readMessage(inputStream); - LOG.info("Received BGP message: {}", msg); - - assertEquals(BGP_OPEN_MSG_TYPE, msg[BGP_MSG_TYPE_OFFSET]); - } - } }
\ No newline at end of file diff --git a/infra/minimal-distribution/src/test/resources/bgp-peers.json b/infra/minimal-distribution/src/test/resources/bgp-peers.json deleted file mode 100644 index 3a7e01060..000000000 --- a/infra/minimal-distribution/src/test/resources/bgp-peers.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "bgp-openconfig-extensions:neighbors": { - "neighbor": [ - { - "neighbor-address": "10.25.1.9", - "config": { - "peer-group": "application-peers" - }, - "afi-safis": { - "afi-safi": [ - { - "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST", - "receive": true, - "send-max": 0 - } - ] - } - }, - { - "neighbor-address": "10.25.1.10", - "config": { - "peer-group": "application-peers" - }, - "afi-safis": { - "afi-safi": [ - { - "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST", - "receive": true, - "send-max": 0 - } - ] - } - }, - { - "neighbor-address": "127.0.0.2", - "config": { - "peer-type": "INTERNAL" - }, - "timers": { - "config": { - "connect-retry": 10, - "hold-time": 90 - } - }, - "transport": { - "config": { - "remote-port": 17900, - "passive-mode": false - } - }, - "afi-safis": { - "afi-safi": [ - { - "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST", - "receive": true, - "send-max": 0 - } - ] - } - }, - { - "neighbor-address": "127.0.0.3", - "config": { - "peer-type": "EXTERNAL" - }, - "timers": { - "config": { - "connect-retry": 10, - "hold-time": 90 - } - }, - "transport": { - "config": { - "remote-port": 17900, - "passive-mode": false - } - }, - "afi-safis": { - "afi-safi": [ - { - "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST", - "receive": true, - "send-max": 0 - } - ] - } - } - ] - } -}
\ No newline at end of file diff --git a/infra/minimal-distribution/src/test/resources/honeycomb.json b/infra/minimal-distribution/src/test/resources/honeycomb.json index be627747b..a0b2a633c 100644 --- a/infra/minimal-distribution/src/test/resources/honeycomb.json +++ b/infra/minimal-distribution/src/test/resources/honeycomb.json @@ -35,14 +35,6 @@ "netconf-ssh-binding-port": 2832, "netconf-notification-stream-name": "honeycomb", - "bgp-enabled": "true", - "bgp-binding-address": "127.0.0.1", - "bgp-port": 1790, - "bgp-as-number": 65000, - "bgp-receive-multiple-paths": "true", - "bgp-send-max-paths": 0, - "bgp-netty-threads": 2, - "username": "admin", "password": "admin" }
\ No newline at end of file |