2 * Copyright (C) 2015 IBM, Inc.
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
9 package org.opendaylight.neutron.spi;
11 import java.util.List;
13 import org.junit.Assert;
14 import org.junit.Test;
16 import org.opendaylight.neutron.spi.JaxbTestHelper;
17 import org.opendaylight.neutron.spi.NeutronFloatingIP;
19 public class NeutronFloatingIPJAXBTest {
21 private static final String NeutronFloatingIP_sourceJson="{" +
22 "\"fixed_ip_address\": \"10.0.0.3\", " +
23 "\"floating_ip_address\": \"172.24.4.228\", " +
24 "\"floating_network_id\": \"376da547-b977-4cfe-9cba-275c80debf57\", " +
25 "\"id\": \"2f245a7b-796b-4f26-9cf9-9e82d248fda7\", " +
26 "\"port_id\": \"ce705c24-c1ef-408a-bda3-7bbd946164ab\", " +
27 "\"router_id\": \"d23abc8d-2991-4a55-ba98-2aaea84cc72f\", " +
28 "\"status\": \"ACTIVE\", " +
29 "\"tenant_id\": \"4969c491a3c74ee4af974e6d800c62de\" }";
32 public void test_NeutronFloatingIP_JAXB() {
33 NeutronFloatingIP dummyObject = new NeutronFloatingIP();
35 NeutronFloatingIP testObject = (NeutronFloatingIP) JaxbTestHelper.jaxbUnmarshall(dummyObject, NeutronFloatingIP_sourceJson);
36 Assert.assertEquals("NeutronFloatingIP JAXB Test 1: Testing id failed",
37 "2f245a7b-796b-4f26-9cf9-9e82d248fda7", testObject.getID());
39 Assert.assertEquals("NeutronFloatingIP JAXB Test 2: Testing tenant_id failed",
40 "4969c491a3c74ee4af974e6d800c62de", testObject.getTenantID());
42 Assert.assertEquals("NeutronFloatingIP JAXB Test 3: Testing router id failed",
43 "d23abc8d-2991-4a55-ba98-2aaea84cc72f", testObject.getRouterUUID());
45 Assert.assertEquals("NeutronFloatingIP JAXB Test 4: Testing port id failed",
46 "ce705c24-c1ef-408a-bda3-7bbd946164ab", testObject.getPortUUID());
48 Assert.assertEquals("NeutronFloatingIP JAXB Test 5: Testing floating network id failed",
49 "376da547-b977-4cfe-9cba-275c80debf57", testObject.getFloatingNetworkUUID());
51 Assert.assertEquals("NeutronFloatingIP JAXB Test 6: Testing floating ip address failed",
52 "172.24.4.228", testObject.getFloatingIPAddress());
54 Assert.assertEquals("NeutronFloatingIP JAXB Test 7: Testing fixed ip address failed",
55 "10.0.0.3", testObject.getFixedIPAddress());
57 Assert.assertEquals("NeutronFloatingIP JAXB Test 8: Testing status failed",
58 "ACTIVE", testObject.getStatus());
59 } catch (Exception e) {
60 Assert.assertTrue("Tests failed", false);