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 org.junit.Assert;
12 import org.junit.Test;
14 import org.opendaylight.neutron.spi.JaxbTestHelper;
15 import org.opendaylight.neutron.spi.NeutronFloatingIP;
17 public class NeutronFloatingIPJAXBTest {
19 private static final String NeutronFloatingIP_sourceJson="{" +
20 "\"fixed_ip_address\": \"10.0.0.3\", " +
21 "\"floating_ip_address\": \"172.24.4.228\", " +
22 "\"floating_network_id\": \"376da547-b977-4cfe-9cba-275c80debf57\", " +
23 "\"id\": \"2f245a7b-796b-4f26-9cf9-9e82d248fda7\", " +
24 "\"port_id\": \"ce705c24-c1ef-408a-bda3-7bbd946164ab\", " +
25 "\"router_id\": \"d23abc8d-2991-4a55-ba98-2aaea84cc72f\", " +
26 "\"status\": \"ACTIVE\", " +
27 "\"tenant_id\": \"4969c491a3c74ee4af974e6d800c62de\" }";
30 public void test_NeutronFloatingIP_JAXB() {
31 NeutronFloatingIP dummyObject = new NeutronFloatingIP();
33 NeutronFloatingIP testObject = (NeutronFloatingIP) JaxbTestHelper.jaxbUnmarshall(dummyObject, NeutronFloatingIP_sourceJson);
34 Assert.assertEquals("NeutronFloatingIP JAXB Test 1: Testing id failed",
35 "2f245a7b-796b-4f26-9cf9-9e82d248fda7", testObject.getID());
37 Assert.assertEquals("NeutronFloatingIP JAXB Test 2: Testing tenant_id failed",
38 "4969c491a3c74ee4af974e6d800c62de", testObject.getTenantID());
40 Assert.assertEquals("NeutronFloatingIP JAXB Test 3: Testing router id failed",
41 "d23abc8d-2991-4a55-ba98-2aaea84cc72f", testObject.getRouterUUID());
43 Assert.assertEquals("NeutronFloatingIP JAXB Test 4: Testing port id failed",
44 "ce705c24-c1ef-408a-bda3-7bbd946164ab", testObject.getPortUUID());
46 Assert.assertEquals("NeutronFloatingIP JAXB Test 5: Testing floating network id failed",
47 "376da547-b977-4cfe-9cba-275c80debf57", testObject.getFloatingNetworkUUID());
49 Assert.assertEquals("NeutronFloatingIP JAXB Test 6: Testing floating ip address failed",
50 "172.24.4.228", testObject.getFloatingIPAddress());
52 Assert.assertEquals("NeutronFloatingIP JAXB Test 7: Testing fixed ip address failed",
53 "10.0.0.3", testObject.getFixedIPAddress());
55 Assert.assertEquals("NeutronFloatingIP JAXB Test 8: Testing status failed",
56 "ACTIVE", testObject.getStatus());
57 } catch (Exception e) {
58 Assert.assertTrue("Tests failed", false);