2 * Copyright (c) 2015 Hewlett-Packard Development Company, L.P. 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
9 package org.opendaylight.neutron.transcriber;
11 import java.util.List;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.neutron.spi.INeutronL2gatewayConnectionCRUD;
14 import org.opendaylight.neutron.spi.NeutronL2gatewayConnection;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.L2gatewayConnections;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.l2gatewayconnections.L2gatewayConnection;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.l2gatewayconnections.L2gatewayConnectionBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.l2gatewayconnections.L2gatewayConnectionKey;
20 public final class NeutronL2gatewayConnectionInterface
21 extends AbstractNeutronInterface<L2gatewayConnection, L2gatewayConnections, L2gatewayConnectionKey,
22 NeutronL2gatewayConnection>
23 implements INeutronL2gatewayConnectionCRUD {
25 NeutronL2gatewayConnectionInterface(DataBroker db) {
26 super(L2gatewayConnectionBuilder.class, db);
30 protected List<L2gatewayConnection> getDataObjectList(L2gatewayConnections l2gatewayConnections) {
31 return l2gatewayConnections.getL2gatewayConnection();
35 protected NeutronL2gatewayConnection fromMd(L2gatewayConnection l2gatewayConnection) {
36 final NeutronL2gatewayConnection result = new NeutronL2gatewayConnection();
37 fromMdBaseAttributes(l2gatewayConnection, result);
39 if (l2gatewayConnection.getL2gatewayId().getValue() != null) {
40 result.setL2gatewayID(String.valueOf(l2gatewayConnection.getL2gatewayId().getValue()));
42 if (l2gatewayConnection.getNetworkId().getValue() != null) {
43 result.setNetworkID(String.valueOf(l2gatewayConnection.getNetworkId().getValue()));
45 if (l2gatewayConnection.getSegmentId() != null) {
46 result.setSegmentID(Integer.valueOf(l2gatewayConnection.getSegmentId()));
48 if (l2gatewayConnection.getPortId() != null) {
49 result.setPortID(String.valueOf(l2gatewayConnection.getPortId().getValue()));
55 protected L2gatewayConnection toMd(NeutronL2gatewayConnection neutronObject) {
56 final L2gatewayConnectionBuilder l2gatewayConnectionBuilder = new L2gatewayConnectionBuilder();
57 toMdBaseAttributes(neutronObject, l2gatewayConnectionBuilder);
59 if (neutronObject.getL2gatewayID() != null) {
60 l2gatewayConnectionBuilder.setL2gatewayId(toUuid(neutronObject.getL2gatewayID()));
62 if (neutronObject.getNetworkID() != null) {
63 l2gatewayConnectionBuilder.setNetworkId(toUuid(neutronObject.getNetworkID()));
65 if (neutronObject.getSegmentID() != null) {
66 l2gatewayConnectionBuilder.setSegmentId((neutronObject.getSegmentID()));
68 if (neutronObject.getPortID() != null) {
69 l2gatewayConnectionBuilder.setPortId(toUuid(neutronObject.getPortID()));
71 return l2gatewayConnectionBuilder.build();