@Override
    public ObjectNode encode(MepLtCreate mepLtCreate, CodecContext context) {
        checkNotNull(mepLtCreate, "Mep Lt Create cannot be null");
        ObjectNode result = context.mapper().createObjectNode();

        if (mepLtCreate.remoteMepId() != null) {
            result.put(REMOTE_MEP_ID, mepLtCreate.remoteMepId().value());
        } else {
            result.put(REMOTE_MEP_MAC, mepLtCreate.remoteMepAddress().toString());
        }

        if (mepLtCreate.defaultTtl() != null) {
            result.put(DEFAULT_TTL, mepLtCreate.defaultTtl());
        }
        if (mepLtCreate.transmitLtmFlags() != null) {
            result.put(TRANSMIT_LTM_FLAGS,
                    mepLtCreate.transmitLtmFlags().get(0) ? USE_FDB_ONLY : "");
        }

        return result;
    }
@Test
    public void testEncodeMepLtCreate() {
        MepId mepId1 = MepId.valueOf((short) 1);
        MepLtCreate mepLtCreate1 = DefaultMepLtCreate
                .builder(mepId1)
                .defaultTtl((short) 20)
                .transmitLtmFlags(BitSet.valueOf(new byte[]{1}))
                .build();

        ObjectMapper mapper = new ObjectMapper();
        CfmCodecContext context = new CfmCodecContext();
        ObjectNode node = mapper.createObjectNode();
        node.set("linktrace", context.codec(MepLtCreate.class).encode(mepLtCreate1, context));

        assertEquals("{\"linktrace\":{" +
                "\"remoteMepId\":1," +
                "\"defaultTtl\":20," +
                "\"transmitLtmFlags\":\"use-fdb-only\"}}", node.toString());
    }