@Override
    public ObjectNode encode(ExternalPeerRouter router, CodecContext context) {
        checkNotNull(router, "External peer router cannot be null");

        return context.mapper().createObjectNode()
                .put(IP_ADDRESS, router.ipAddress().toString())
                .put(MAC_ADDRESS, router.macAddress().toString())
                .put(VLAN_ID, router.vlanId().toString());
    }
@Test
    public void testExternalPeerRouterEncode() {
        ExternalPeerRouter router = DefaultExternalPeerRouter.builder()
                .ipAddress(IpAddress.valueOf("10.10.10.1"))
                .macAddress(MacAddress.valueOf("11:22:33:44:55:66"))
                .vlanId(VlanId.vlanId("1"))
                .build();

        ObjectNode routerJson = externalPeerRouterCodec.encode(router, context);
        assertThat(routerJson, matchesExternalPeerRouter(router));
    }