import org.opendaylight.neutron.spi.INeutronSFCPortChainCRUD;
import org.opendaylight.neutron.spi.NeutronSFCPortChain;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.port.chain.attributes.ChainParameters;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.port.chain.attributes.ChainParametersBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.port.chain.attributes.ChainParametersKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.PortChains;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.chains.PortChain;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.chains.PortChainBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.chains.PortChainKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Created by Anil Vishnoi (avishnoi@Brocade.com)
+ * Created by Anil Vishnoi (avishnoi@Brocade.com).
*/
public final class NeutronSFCPortChainInterface
- extends AbstractNeutronInterface<PortChain, PortChains, NeutronSFCPortChain>
+ extends AbstractNeutronInterface<PortChain, PortChains, PortChainKey, NeutronSFCPortChain>
implements INeutronSFCPortChainCRUD {
- private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortChainInterface.class);
+ private static final Logger LOG = LoggerFactory.getLogger(NeutronSFCPortChainInterface.class);
NeutronSFCPortChainInterface(DataBroker db) {
- super(db);
+ super(PortChainBuilder.class, db);
}
@Override
return dataObjects.getPortChain();
}
- @Override
- protected InstanceIdentifier<PortChain> createInstanceIdentifier(PortChain portChain) {
- return InstanceIdentifier.create(Neutron.class).child(PortChains.class).child(PortChain.class,
- portChain.getKey());
- }
-
- @Override
- protected InstanceIdentifier<PortChains> createInstanceIdentifier() {
- return InstanceIdentifier.create(Neutron.class).child(PortChains.class);
- }
-
@Override
protected PortChain toMd(NeutronSFCPortChain neutronPortChain) {
- LOGGER.trace("toMd: REST SFC Port Chain data : {}", neutronPortChain);
+ LOG.trace("toMd: REST SFC Port Chain data : {}", neutronPortChain);
PortChainBuilder result = new PortChainBuilder();
- result.setUuid(new Uuid(neutronPortChain.getID()));
- result.setName(neutronPortChain.getName());
- result.setTenantId(toUuid(neutronPortChain.getTenantID()));
+ toMdBaseAttributes(neutronPortChain, result);
if (neutronPortChain.getPortPairGroupsUUID() != null) {
List<Uuid> portPairGroups = new ArrayList<>();
for (String uuid : neutronPortChain.getPortPairGroupsUUID()) {
}
result.setChainParameters(chainParams);
}
- LOGGER.trace("toMd: Yang SFC Port Chain data : {}", result);
+ LOG.trace("toMd: Yang SFC Port Chain data : {}", result);
return result.build();
}
- @Override
- protected PortChain toMd(String uuid) {
- final PortChainBuilder portChainBuilder = new PortChainBuilder();
- portChainBuilder.setUuid(toUuid(uuid));
- return portChainBuilder.build();
- }
-
@Override
protected NeutronSFCPortChain fromMd(PortChain mdPortChain) {
- LOGGER.trace("fromMd: Yang SFC Port Chain data : {}", mdPortChain);
+ LOG.trace("fromMd: Yang SFC Port Chain data : {}", mdPortChain);
NeutronSFCPortChain result = new NeutronSFCPortChain();
- result.setID(mdPortChain.getUuid().getValue());
- result.setName(mdPortChain.getName());
- result.setTenantID(mdPortChain.getTenantId());
+ fromMdBaseAttributes(mdPortChain, result);
if (mdPortChain.getPortPairGroups() != null) {
List<String> portPairGroups = new ArrayList<>();
for (Uuid uuid : mdPortChain.getPortPairGroups()) {
}
result.setChainParameters(chainParams);
}
- LOGGER.trace("fromMd: REST SFC Port Chain data : {}", result);
+ LOG.trace("fromMd: REST SFC Port Chain data : {}", result);
return result;
}
}