@Override
    public MepLtCreate decode(ObjectNode json, CodecContext context) {
        if (json == null || !json.isObject()) {
            return null;
        }

        JsonNode linktraceNode = json.get(LINKTRACE);

        JsonNode remoteMepIdNode = linktraceNode.get(REMOTE_MEP_ID);
        JsonNode remoteMepMacNode = linktraceNode.get(REMOTE_MEP_MAC);

        MepLtCreate.MepLtCreateBuilder ltCreateBuilder;
        if (remoteMepIdNode != null) {
            MepId remoteMepId = MepId.valueOf((short) remoteMepIdNode.asInt());
            ltCreateBuilder = DefaultMepLtCreate.builder(remoteMepId);
        } else if (remoteMepMacNode != null) {
            MacAddress remoteMepMac = MacAddress.valueOf(
                                            remoteMepMacNode.asText());
            ltCreateBuilder = DefaultMepLtCreate.builder(remoteMepMac);
        } else {
            throw new IllegalArgumentException(
                    "Either a remoteMepId or a remoteMepMac");
        }

        JsonNode defaultTtlNode = linktraceNode.get(DEFAULT_TTL);
        if (defaultTtlNode != null) {
            short defaultTtl = (short) defaultTtlNode.asInt();
            ltCreateBuilder.defaultTtl(defaultTtl);
        }

        JsonNode transmitLtmFlagsNode = linktraceNode.get(TRANSMIT_LTM_FLAGS);
        if (transmitLtmFlagsNode != null) {
            if (transmitLtmFlagsNode.asText().isEmpty()) {
                ltCreateBuilder.transmitLtmFlags(BitSet.valueOf(new long[]{0}));
            } else if (transmitLtmFlagsNode.asText().equals(USE_FDB_ONLY)) {
               ltCreateBuilder.transmitLtmFlags(BitSet.valueOf(new long[]{1}));
            } else {
                throw new IllegalArgumentException("Expecting value 'use-fdb-only' " +
                        "or '' for " + TRANSMIT_LTM_FLAGS);
            }
        }

        return ltCreateBuilder.build();
    }
@Test
    public void testDecodeMepLtCreateMepId() throws JsonProcessingException, IOException {
        String linktraceString = "{\"linktrace\": {    " +
                "\"remoteMepId\": 20," +
                "\"defaultTtl\": 21," +
                "\"transmitLtmFlags\": \"use-fdb-only\"}}";

        InputStream input = new ByteArrayInputStream(
                linktraceString.getBytes(StandardCharsets.UTF_8));
        JsonNode cfg = mapper.readTree(input);
        MepLtCreate mepLtCreate = context
                .codec(MepLtCreate.class).decode((ObjectNode) cfg, context);

        assertNull(mepLtCreate.remoteMepAddress());
        assertEquals(20, mepLtCreate.remoteMepId().id().shortValue());
        assertEquals(21, mepLtCreate.defaultTtl().intValue());
        assertEquals(BitSet.valueOf(new byte[]{1}), mepLtCreate.transmitLtmFlags());
    }