2 * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.neutron.spi;
10 import org.junit.Assert;
11 import org.junit.Test;
13 import javax.xml.bind.JAXBException;
17 * Created by Anil Vishnoi (avishnoi@Brocade.com)
19 public class NeutronSFCPortPairJAXBTest {
21 private static final String NeutronSFCPortPair_sourceJson = "{ "
22 + "\"name\": \"portpair1\", "
23 + "\"ingress\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\", "
24 + "\"egress\": \"6e8e5957-649f-477b-9e5b-f1f75b21c03c\", "
25 + "\"service_function_parameters\": [ "
27 + "\"correlation\": \"value\" "
30 + "\"tenant_id\": \"4969c491a3c74ee4af974e6d800c62de\", "
31 + "\"id\": \"4e8e5957-649f-477b-9e5b-f1f75b21c03c\" }";
34 public void test_NeutronSFCPortPair_JAXB() throws JAXBException {
35 NeutronSFCPortPair testObject = new NeutronSFCPortPair();
36 NeutronSFCPortPair neutronObject
37 = (NeutronSFCPortPair) JaxbTestHelper.jaxbUnmarshall(testObject
38 , NeutronSFCPortPair_sourceJson);
40 Assert.assertEquals("NeutronSFCPortPair JAXB Test 1: Testing id failed"
41 , "4e8e5957-649f-477b-9e5b-f1f75b21c03c",neutronObject.getID());
43 Assert.assertEquals("NeutronSFCPortPair JAXB Test 2: Testing tenant_id failed",
44 "4969c491a3c74ee4af974e6d800c62de", neutronObject.getTenantID());
46 Assert.assertEquals("NeutronSFCPortPair JAXB Test 3: Testing ingress failed",
47 "5e8e5957-649f-477b-9e5b-f1f75b21c03c", neutronObject.getIngressPortUUID());
49 Assert.assertEquals("NeutronSFCPortPair JAXB Test 4: Testing egress failed",
50 "6e8e5957-649f-477b-9e5b-f1f75b21c03c", neutronObject.getEgressPortUUID());
52 Map<String, String> param = neutronObject.getServiceFunctionParameters();
53 Assert.assertEquals("NeutronSFCPortPair JAXB Test 5: Testing service_function_parameters list length " +
54 "failed", 1, param.size());