use of org.onosproject.k8snode.api.K8sHost in project onos by opennetworkinglab.
the class K8sHostCodecTest method testK8sHostEncode.
/**
* Tests the kubernetes host encoding.
*/
@Test
public void testK8sHostEncode() {
K8sHost host = DefaultK8sHost.builder().hostIp(IpAddress.valueOf("192.168.200.10")).state(INIT).nodeNames(ImmutableSet.of("1", "2")).build();
ObjectNode hostJson = k8sHostCodec.encode(host, context);
assertThat(hostJson, matchesK8sHost(host));
}
use of org.onosproject.k8snode.api.K8sHost in project onos by opennetworkinglab.
the class K8sHostCodecTest method getK8sHost.
private K8sHost getK8sHost(String resourceName) throws IOException {
InputStream jsonStream = K8sHostCodecTest.class.getResourceAsStream(resourceName);
JsonNode json = context.mapper().readTree(jsonStream);
assertThat(json, notNullValue());
K8sHost host = k8sHostCodec.decode((ObjectNode) json, context);
assertThat(host, notNullValue());
return host;
}
use of org.onosproject.k8snode.api.K8sHost in project onos by opennetworkinglab.
the class K8sHostCodecTest method testK8sHostDecode.
/**
* Tests the kubernetes host decoding.
*/
@Test
public void testK8sHostDecode() throws IOException {
K8sHost host = getK8sHost("K8sHost.json");
assertEquals("192.168.200.10", host.hostIp().toString());
assertEquals("INIT", host.state().name());
}
use of org.onosproject.k8snode.api.K8sHost in project onos by opennetworkinglab.
the class K8sHostManagerTest method testUpdateHost.
/**
* Checks if updating a host works well with proper event.
*/
@Test
public void testUpdateHost() {
K8sHost updated = HOST_2.updateState(COMPLETE);
target.updateHost(updated);
validateEvents(K8S_HOST_UPDATED, K8S_HOST_COMPLETE);
}
Aggregations