Search in sources :

Example 1 with List1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1 in project netvirt by opendaylight.

the class NeutronvpnUtils method getFixedIpsDelta.

/**
 * Gets the fixed ips delta.
 *
 * @param port1FixedIps the port 1 fixed ips
 * @param port2FixedIps the port 2 fixed ips
 * @return the fixed ips delta
 */
protected static List<FixedIps> getFixedIpsDelta(List<FixedIps> port1FixedIps, List<FixedIps> port2FixedIps) {
    if (port1FixedIps == null) {
        return null;
    }
    if (port2FixedIps == null) {
        return port1FixedIps;
    }
    List<FixedIps> list1 = new ArrayList<>(port1FixedIps);
    List<FixedIps> list2 = new ArrayList<>(port2FixedIps);
    for (Iterator<FixedIps> iterator = list1.iterator(); iterator.hasNext(); ) {
        FixedIps fixedIps1 = iterator.next();
        for (FixedIps fixedIps2 : list2) {
            if (fixedIps1.getIpAddress().equals(fixedIps2.getIpAddress())) {
                iterator.remove();
                break;
            }
        }
    }
    return list1;
}
Also used : ArrayList(java.util.ArrayList) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps)

Example 2 with List1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1 in project netvirt by opendaylight.

the class NeutronvpnUtils method getSecurityGroupsDelta.

/**
 * Gets security group UUIDs delta   .
 *
 * @param port1SecurityGroups the port 1 security groups
 * @param port2SecurityGroups the port 2 security groups
 * @return the security groups delta
 */
protected static List<Uuid> getSecurityGroupsDelta(List<Uuid> port1SecurityGroups, List<Uuid> port2SecurityGroups) {
    if (port1SecurityGroups == null) {
        return null;
    }
    if (port2SecurityGroups == null) {
        return port1SecurityGroups;
    }
    List<Uuid> list1 = new ArrayList<>(port1SecurityGroups);
    List<Uuid> list2 = new ArrayList<>(port2SecurityGroups);
    for (Iterator<Uuid> iterator = list1.iterator(); iterator.hasNext(); ) {
        Uuid securityGroup1 = iterator.next();
        for (Uuid securityGroup2 : list2) {
            if (securityGroup1.getValue().equals(securityGroup2.getValue())) {
                iterator.remove();
                break;
            }
        }
    }
    return list1;
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) ArrayList(java.util.ArrayList)

Example 3 with List1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1 in project controller by opendaylight.

the class WriteParentReadChildTest method writeParentReadChild.

/**
 * The scenario tests writing parent node, which also contains child items
 * and then reading child directly, by specifying path to the child.
 * Expected behaviour is child is returned.
 */
@Test
public void writeParentReadChild() throws Exception {
    DataBroker dataBroker = testContext.getDataBroker();
    final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
    List11 list11 = // 
    new List11Builder().setKey(// 
    LIST11_KEY).setAttrStr("primary").build();
    List1 list1 = new List1Builder().setKey(LIST1_KEY).setList11(ImmutableList.of(list11)).build();
    transaction.put(LogicalDatastoreType.OPERATIONAL, LIST1_INSTANCE_ID_BA, list1, true);
    transaction.submit().get(5, TimeUnit.SECONDS);
    Optional<List1> readList1 = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, LIST1_INSTANCE_ID_BA).get(1000, TimeUnit.MILLISECONDS);
    assertTrue(readList1.isPresent());
    Optional<? extends DataObject> readList11 = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, LIST11_INSTANCE_ID_BA).get(5, TimeUnit.SECONDS);
    assertNotNull("Readed flow should not be null.", readList11);
    assertTrue(readList11.isPresent());
    assertEquals(list11, readList11.get());
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) List11(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11) List1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1) List11Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11Builder) List1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1Builder) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) AbstractDataServiceTest(org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)2 Test (org.junit.Test)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 AbstractDataServiceTest (org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 FixedIps (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps)1 List1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1)1 List1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1Builder)1 List11 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11)1 List11Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11Builder)1