Search in sources :

Example 1 with FixedIpsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsBuilder in project netvirt by opendaylight.

the class NeutronPortChangeListenerTest method addPort__Ipv4FixedIps.

@Test
public void addPort__Ipv4FixedIps() throws Exception {
    PortBuilder pb = new PortBuilder();
    pb.setUuid(new Uuid("12345678-1234-1234-1234-123456789012"));
    pb.setNetworkId(new Uuid("12345678-1234-1234-1234-123456789012"));
    pb.setMacAddress(new MacAddress("AA:BB:CC:DD:EE:FF"));
    IpAddress ipv4 = new IpAddress(new Ipv4Address("2.2.2.2"));
    FixedIpsBuilder fib = new FixedIpsBuilder();
    fib.setIpAddress(ipv4);
    List<FixedIps> fixedIps = new ArrayList<>();
    fixedIps.add(fib.build());
    pb.setFixedIps(fixedIps);
    Port port = pb.build();
    neutronPortChangeListener.add(InstanceIdentifier.create(Port.class), port);
}
Also used : FixedIpsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsBuilder) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) PortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Test(org.junit.Test)

Example 2 with FixedIpsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsBuilder in project netvirt by opendaylight.

the class NeutronPortChangeListenerTest method addPort__Ipv6FixedIps.

@Test
public void addPort__Ipv6FixedIps() throws Exception {
    PortBuilder pb = new PortBuilder();
    pb.setUuid(new Uuid("12345678-1234-1234-1234-123456789012"));
    pb.setNetworkId(new Uuid("12345678-1234-1234-1234-123456789012"));
    pb.setMacAddress(new MacAddress("AA:BB:CC:DD:EE:FF"));
    IpAddress ipv6 = new IpAddress(new Ipv6Address("1::1"));
    FixedIpsBuilder fib = new FixedIpsBuilder();
    fib.setIpAddress(ipv6);
    List<FixedIps> fixedIps = new ArrayList<>();
    fixedIps.add(fib.build());
    pb.setFixedIps(fixedIps);
    Port port = pb.build();
    neutronPortChangeListener.add(InstanceIdentifier.create(Port.class), port);
}
Also used : FixedIpsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsBuilder) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) PortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)2 FixedIps (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps)2 FixedIpsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsBuilder)2 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)2 PortBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)1