use of org.onosproject.openstacktelemetry.api.DefaultTelemetryConfig in project onos by opennetworkinglab.
the class DefaultGrpcTelemetryConfigTest method testPropsExtraction.
/**
* Tests props extraction.
*/
@Test
public void testPropsExtraction() {
Map<String, String> props = Maps.newConcurrentMap();
props.put(ADDRESS, IP_ADDRESS_1);
props.put(PORT, String.valueOf(PORT_1));
props.put(MAX_INBOUND_MSG_SIZE, String.valueOf(MSG_SIZE_1));
props.put(USE_PLAINTEXT, String.valueOf(USE_PLAIN_TEXT_1));
TelemetryConfig config = new DefaultTelemetryConfig(DUMMY, GRPC, ImmutableList.of(), DUMMY, DUMMY, ENABLED, props);
GrpcTelemetryConfig grpcConfig = fromTelemetryConfig(config);
assertThat(grpcConfig.address(), is(IP_ADDRESS_1));
assertThat(grpcConfig.port(), is(PORT_1));
assertThat(grpcConfig.maxInboundMsgSize(), is(MSG_SIZE_1));
assertThat(grpcConfig.usePlaintext(), is(USE_PLAIN_TEXT_1));
}
use of org.onosproject.openstacktelemetry.api.DefaultTelemetryConfig in project onos by opennetworkinglab.
the class DefaultPrometheusTelemetryConfigTest method testPropsExtraction.
/**
* Tests props extraction.
*/
@Test
public void testPropsExtraction() {
Map<String, String> props = Maps.newConcurrentMap();
props.put(ADDRESS, IP_ADDRESS_1);
props.put(PORT, String.valueOf(PORT_1));
TelemetryConfig config = new DefaultTelemetryConfig(DUMMY, PROMETHEUS, ImmutableList.of(), DUMMY, DUMMY, DISABLED, props);
PrometheusTelemetryConfig prometheusConfig = fromTelemetryConfig(config);
assertThat(prometheusConfig.address(), is(IP_ADDRESS_1));
assertThat(prometheusConfig.port(), is(PORT_1));
}
use of org.onosproject.openstacktelemetry.api.DefaultTelemetryConfig in project onos by opennetworkinglab.
the class DefaultRestTelemetryConfigTest method testPropsExtraction.
/**
* Tests props extraction.
*/
@Test
public void testPropsExtraction() {
Map<String, String> props = Maps.newConcurrentMap();
props.put(ADDRESS, IP_ADDRESS_1);
props.put(PORT, String.valueOf(PORT_1));
props.put(ENDPOINT, ENDPOINT_1);
props.put(METHOD, METHOD_1);
props.put(REQUEST_MEDIA_TYPE, REQUEST_MEDIA_TYPE_1);
props.put(RESPONSE_MEDIA_TYPE, RESPONSE_MEDIA_TYPE_1);
TelemetryConfig config = new DefaultTelemetryConfig(DUMMY, REST, ImmutableList.of(), DUMMY, DUMMY, DISABLED, props);
RestTelemetryConfig restConfig = DefaultRestTelemetryConfig.fromTelemetryConfig(config);
assertThat(restConfig.address(), is(IP_ADDRESS_1));
assertThat(restConfig.port(), is(PORT_1));
assertThat(restConfig.endpoint(), is(ENDPOINT_1));
assertThat(restConfig.method(), is(METHOD_1));
assertThat(restConfig.requestMediaType(), is(REQUEST_MEDIA_TYPE_1));
assertThat(restConfig.responseMediaType(), is(RESPONSE_MEDIA_TYPE_1));
}
use of org.onosproject.openstacktelemetry.api.DefaultTelemetryConfig in project onos by opennetworkinglab.
the class TelemetryConfigCodecTest method testTelemetryConfigEncode.
/**
* Tests the telemetry config encoding.
*/
@Test
public void testTelemetryConfigEncode() {
String name = "grpc";
TelemetryConfig.ConfigType type = TelemetryConfig.ConfigType.GRPC;
String manufacturer = "grpc.io";
String swVersion = "1.0";
TelemetryConfig.Status status = ENABLED;
Map<String, String> properties = Maps.newConcurrentMap();
properties.put("key1", "value1");
properties.put("key2", "value2");
TelemetryConfig config = new DefaultTelemetryConfig(name, type, ImmutableList.of(), manufacturer, swVersion, status, properties);
ObjectNode configJson = telemetryConfigCodec.encode(config, context);
assertThat(configJson, matchesTelemetryConfig(config));
}
use of org.onosproject.openstacktelemetry.api.DefaultTelemetryConfig in project onos by opennetworkinglab.
the class OpenstackTelemetryConfigWebResourceTest method setUpTest.
/**
* Sets up the global values for all the tests.
*/
@Before
public void setUpTest() {
ServiceDirectory testDirectory = new TestServiceDirectory().add(TelemetryConfigAdminService.class, mockConfigAdminService);
setServiceDirectory(testDirectory);
PROP.put(PROP_KEY_1, PROP_VALUE_1);
PROP.put(PROP_KEY_2, PROP_VALUE_2);
telemetryConfig = new DefaultTelemetryConfig(NAME, TYPE, null, MANUFACTURER, SW_VERSION, STATUS, PROP);
}
Aggregations