Move pcep base parser Activator to its own bundle
[bgpcep.git] / pcep / impl / src / test / java / org / opendaylight / protocol / pcep / impl / TestVendorInformationObjectParser.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.protocol.pcep.impl;
10
11 import io.netty.buffer.ByteBuf;
12
13 import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
14 import org.opendaylight.protocol.pcep.parser.object.AbstractVendorInformationObjectParser;
15 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.EnterpriseSpecificInformation;
18
19 public class TestVendorInformationObjectParser extends AbstractVendorInformationObjectParser {
20
21     private static final EnterpriseNumber TEST_ENTERPRISE_NUMBER = new EnterpriseNumber(0L);
22
23     @Override
24     public void serializeEnterpriseSpecificInformation(final EnterpriseSpecificInformation enterpriseSpecificInformation,
25             final ByteBuf buffer) {
26         buffer.writeInt(((TestEnterpriseSpecificInformation) enterpriseSpecificInformation).getValue());
27     }
28
29     @Override
30     public EnterpriseSpecificInformation parseEnterpriseSpecificInformation(final ByteBuf buffer)
31             throws PCEPDeserializerException {
32         return new TestEnterpriseSpecificInformation(buffer.readInt());
33     }
34
35     @Override
36     public EnterpriseNumber getEnterpriseNumber() {
37         return TEST_ENTERPRISE_NUMBER;
38     }
39
40 }