From a36d06de791b24cfaca4854997794121739a2c59 Mon Sep 17 00:00:00 2001 From: Vishal Thapar Date: Fri, 4 Dec 2015 14:43:38 +0530 Subject: [PATCH] Initial commit for DHCPService This adds basic skeletal code for DHCP Service to be used by VPNService modules. Change-Id: I988d87d1d4cc3b6345ca7b47d2a7f38f1a4e7c5a Signed-off-by: Vishal Thapar --- commons/config-parent/pom.xml | 1 + dhcpservice/dhcpservice-api/pom.xml | 23 ++++ .../dhcpservice/api/DHCPConstants.java | 130 ++++++++++++++++++ .../dhcpservice/api/DHCPMConstants.java | 37 +++++ .../vpnservice/dhcpservice/api/DHCPUtils.java | 89 ++++++++++++ .../src/main/yang/dhcpservice-api.yang | 11 ++ dhcpservice/dhcpservice-impl/pom.xml | 54 ++++++++ .../src/main/config/default-config.xml | 43 ++++++ .../dhcpservice/DhcpPktHandler.java | 37 +++++ .../vpnservice/dhcpservice/DhcpProvider.java | 60 ++++++++ .../impl/rev150710/DhcpServiceImplModule.java | 27 ++++ .../DhcpServiceImplModuleFactory.java | 13 ++ .../src/main/yang/dhcpservice-impl.yang | 61 ++++++++ dhcpservice/pom.xml | 49 +++++++ features/pom.xml | 25 +++- features/src/main/features/features.xml | 9 +- pom.xml | 1 + 17 files changed, 663 insertions(+), 7 deletions(-) create mode 100644 dhcpservice/dhcpservice-api/pom.xml create mode 100644 dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPConstants.java create mode 100644 dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPMConstants.java create mode 100644 dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPUtils.java create mode 100644 dhcpservice/dhcpservice-api/src/main/yang/dhcpservice-api.yang create mode 100644 dhcpservice/dhcpservice-impl/pom.xml create mode 100644 dhcpservice/dhcpservice-impl/src/main/config/default-config.xml create mode 100644 dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpPktHandler.java create mode 100644 dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpProvider.java create mode 100644 dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModule.java create mode 100644 dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModuleFactory.java create mode 100644 dhcpservice/dhcpservice-impl/src/main/yang/dhcpservice-impl.yang create mode 100644 dhcpservice/pom.xml diff --git a/commons/config-parent/pom.xml b/commons/config-parent/pom.xml index 60c9534b..a3fff3a8 100644 --- a/commons/config-parent/pom.xml +++ b/commons/config-parent/pom.xml @@ -31,6 +31,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html 0.2.0-SNAPSHOT 1.2.1-SNAPSHOT 0.10.0-SNAPSHOT + 0.6.0-SNAPSHOT diff --git a/dhcpservice/dhcpservice-api/pom.xml b/dhcpservice/dhcpservice-api/pom.xml new file mode 100644 index 00000000..f40230dc --- /dev/null +++ b/dhcpservice/dhcpservice-api/pom.xml @@ -0,0 +1,23 @@ + + + + + org.opendaylight.vpnservice + binding-parent + 0.2.0-SNAPSHOT + ../../commons/binding-parent + + + 4.0.0 + org.opendaylight.vpnservice + dhcpservice-api + ${vpnservices.version} + bundle + + diff --git a/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPConstants.java b/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPConstants.java new file mode 100644 index 00000000..e5c751c4 --- /dev/null +++ b/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPConstants.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.vpnservice.dhcpservice.api; + +public final class DHCPConstants { + + // DHCP BOOTP CODES + public static final byte BOOTREQUEST = 1; + public static final byte BOOTREPLY = 2; + + // DHCP HTYPE CODES + public static final byte HTYPE_ETHER = 1; + + // DHCP MESSAGE CODES + public static final byte MSG_DISCOVER = 1; + public static final byte MSG_OFFER = 2; + public static final byte MSG_REQUEST = 3; + public static final byte MSG_DECLINE = 4; + public static final byte MSG_ACK = 5; + public static final byte MSG_NAK = 6; + public static final byte MSG_RELEASE = 7; + public static final byte MSG_INFORM = 8; + public static final byte MSG_FORCERENEW = 9; + + // DHCP OPTIONS CODE + public static final byte OPT_PAD = 0; + public static final byte OPT_SUBNET_MASK = 1; + public static final byte OPT_TIME_OFFSET = 2; + public static final byte OPT_ROUTERS = 3; + public static final byte OPT_TIME_SERVERS = 4; + public static final byte OPT_NAME_SERVERS = 5; + public static final byte OPT_DOMAIN_NAME_SERVERS = 6; + public static final byte OPT_LOG_SERVERS = 7; + public static final byte OPT_COOKIE_SERVERS = 8; + public static final byte OPT_LPR_SERVERS = 9; + public static final byte OPT_IMPRESS_SERVERS = 10; + public static final byte OPT_RESOURCE_LOCATION_SERVERS = 11; + public static final byte OPT_HOST_NAME = 12; + public static final byte OPT_BOOT_SIZE = 13; + public static final byte OPT_MERIT_DUMP = 14; + public static final byte OPT_DOMAIN_NAME = 15; + public static final byte OPT_SWAP_SERVER = 16; + public static final byte OPT_ROOT_PATH = 17; + public static final byte OPT_EXTENSIONS_PATH = 18; + public static final byte OPT_IP_FORWARDING = 19; + public static final byte OPT_NON_LOCAL_SOURCE_ROUTING = 20; + public static final byte OPT_POLICY_FILTER = 21; + public static final byte OPT_MAX_DGRAM_REASSEMBLY = 22; + public static final byte OPT_DEFAULT_IP_TTL = 23; + public static final byte OPT_PATH_MTU_AGING_TIMEOUT = 24; + public static final byte OPT_PATH_MTU_PLATEAU_TABLE = 25; + public static final byte OPT_INTERFACE_MTU = 26; + public static final byte OPT_ALL_SUBNETS_LOCAL = 27; + public static final byte OPT_BROADCAST_ADDRESS = 28; + public static final byte OPT_PERFORM_MASK_DISCOVERY = 29; + public static final byte OPT_MASK_SUPPLIER = 30; + public static final byte OPT_ROUTER_DISCOVERY = 31; + public static final byte OPT_ROUTER_SOLICITATION_ADDRESS = 32; + public static final byte OPT_STATIC_ROUTES = 33; + public static final byte OPT_TRAILER_ENCAPSULATION = 34; + public static final byte OPT_ARP_CACHE_TIMEOUT = 35; + public static final byte OPT_IEEE802_3_ENCAPSULATION = 36; + public static final byte OPT_DEFAULT_TCP_TTL = 37; + public static final byte OPT_TCP_KEEPALIVE_INTERVAL = 38; + public static final byte OPT_TCP_KEEPALIVE_GARBAGE = 39; + public static final byte OPT_NIS_SERVERS = 41; + public static final byte OPT_NTP_SERVERS = 42; + public static final byte OPT_VENDOR_ENCAPSULATED_OPTIONS = 43; + public static final byte OPT_NETBIOS_NAME_SERVERS = 44; + public static final byte OPT_NETBIOS_DD_SERVER = 45; + public static final byte OPT_NETBIOS_NODE_TYPE = 46; + public static final byte OPT_NETBIOS_SCOPE = 47; + public static final byte OPT_FONT_SERVERS = 48; + public static final byte OPT_X_DISPLAY_MANAGER = 49; + public static final byte OPT_REQUESTED_ADDRESS = 50; + public static final byte OPT_LEASE_TIME = 51; + public static final byte OPT_OPTION_OVERLOAD = 52; + public static final byte OPT_MESSAGE_TYPE = 53; + public static final byte OPT_SERVER_IDENTIFIER = 54; + public static final byte OPT_PARAMETER_REQUEST_LIST = 55; + public static final byte OPT_MESSAGE = 56; + public static final byte OPT_MAX_MESSAGE_SIZE = 57; + public static final byte OPT_RENEWAL_TIME = 58; + public static final byte OPT_REBINDING_TIME = 59; + public static final byte OPT_VENDOR_CLASS_IDENTIFIER = 60; + public static final byte OPT_CLIENT_IDENTIFIER = 61; + public static final byte OPT_NWIP_DOMAIN_NAME = 62; + public static final byte OPT_NWIP_SUBOPTIONS = 63; + public static final byte OPT_NISPLUS_DOMAIN = 64; + public static final byte OPT_NISPLUS_SERVER = 65; + public static final byte OPT_TFTP_SERVER = 66; + public static final byte OPT_BOOTFILE = 67; + public static final byte OPT_MOBILE_IP_HOME_AGENT = 68; + public static final byte OPT_SMTP_SERVER = 69; + public static final byte OPT_POP3_SERVER = 70; + public static final byte OPT_NNTP_SERVER = 71; + public static final byte OPT_WWW_SERVER = 72; + public static final byte OPT_FINGER_SERVER = 73; + public static final byte OPT_IRC_SERVER = 74; + public static final byte OPT_STREETTALK_SERVER = 75; + public static final byte OPT_STDA_SERVER = 76; + public static final byte OPT_USER_CLASS = 77; + public static final byte OPT_FQDN = 81; + public static final byte OPT_AGENT_OPTIONS = 82; + public static final byte OPT_NDS_SERVERS = 85; + public static final byte OPT_NDS_TREE_NAME = 86; + public static final byte OPT_NDS_CONTEXT = 87; + public static final byte OPT_CLIENT_LAST_TRANSACTION_TIME = 91; + public static final byte OPT_ASSOCIATED_IP = 92; + public static final byte OPT_USER_AUTHENTICATION_PROTOCOL = 98; + public static final byte OPT_AUTO_CONFIGURE = 116; + public static final byte OPT_NAME_SERVICE_SEARCH = 117; + public static final byte OPT_SUBNET_SELECTION = 118; + public static final byte OPT_DOMAIN_SEARCH = 119; + public static final byte OPT_CLASSLESS_ROUTE = 121; + public static final byte OPT_END = -1; + + public static final int MAGIC_COOKIE = 0x63825363; + + public static final int DHCP_MIN_SIZE = 300; + public static final int DHCP_MAX_SIZE = 576; + + public static final int DHCP_NOOPT_HDR_SIZE = 240; +} diff --git a/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPMConstants.java b/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPMConstants.java new file mode 100644 index 00000000..9da75e9d --- /dev/null +++ b/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPMConstants.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.vpnservice.dhcpservice.api; + +import java.math.BigInteger; + +public final class DHCPMConstants { + + // DHCP Service Table Ids + public static final short DHCP_TABLE = 0; + public static final short L3_FIB_TABLE = 20; + + public static final long DHCP_TABLE_MAX_ENTRY = 10000; + + public static final int DEFAULT_DHCP_FLOW_PRIORITY = 50; + public static final int ARP_FLOW_PRIORITY = 50; + + public static final BigInteger COOKIE_DHCP_BASE = new BigInteger("6800000", 16); + public static final BigInteger METADATA_ALL_CLEAR_MASK = new BigInteger("0000000000000000", 16); + public static final BigInteger METADATA_ALL_SET_MASK = new BigInteger("FFFFFFFFFFFFFFFF", 16); + + public static final String FLOWID_PREFIX = "DHCP."; + public static final String VMFLOWID_PREFIX = "DHCP.INTERFACE."; + public static final String BCAST_DEST_IP = "255.255.255.255"; + public static final int BCAST_IP = 0xffffffff; + + public static final short dhcpClientPort = 68; + public static final short dhcpServerPort = 67; + + public static final int DEFAULT_LEASE_TIME = 86400; +} diff --git a/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPUtils.java b/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPUtils.java new file mode 100644 index 00000000..167e8077 --- /dev/null +++ b/dhcpservice/dhcpservice-api/src/main/java/org/opendaylight/vpnservice/dhcpservice/api/DHCPUtils.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.vpnservice.dhcpservice.api; + + +import java.math.BigInteger; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.List; + +public abstract class DHCPUtils { + + public static byte[] byteToByteArray(byte b) { + return new byte[] {b}; + } + + public static byte[] shortToByteArray(short s) { + return new byte[] { (byte) ((s >> 8) & 0xff), (byte) (s & 0xff) }; + } + + public static byte[] intToByteArray(int i ) { + return new byte[] { (byte) ((i >> 24) & 0xff), (byte) ((i >> 16) & 0xff), (byte) ((i >> 8) & 0xff), + (byte) (i & 0xff) }; + } + + public static byte[] inetAddrToByteArray(InetAddress a) { + return a.getAddress(); + } + + public static byte[] strAddrToByteArray(String addr) { + try { + return InetAddress.getByName(addr).getAddress(); + } catch (UnknownHostException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + public static byte[] strListAddrsToByteArray(List strList) { + byte[] result = new byte[strList.size() * 4]; + byte[] addr = new byte[4]; + try { + for (int i = 0; i < strList.size(); i++) { + addr = InetAddress.getByName(strList.get(i)).getAddress(); + System.arraycopy(addr, 0, result, i*4, 4); + } + } catch (UnknownHostException e) { + return null; + } + return result; + } + + public static short byteArrayToShort(byte[] ba) { + if (ba == null || ba.length != 2) { + return 0; + } + return (short) ((0xff & ba[0]) << 8 | (0xff & ba[1])); + } + + public static InetAddress byteArrayToInetAddr(byte[] ba) { + try { + return InetAddress.getByAddress(ba); + } catch (UnknownHostException e) { + return null; + } + } + + public static byte[] strMacAddrtoByteArray(String macAddress) { + if(macAddress == null) { + return null; + } + String[] bytes = macAddress.split(":"); + byte[] result = new byte[bytes.length]; + for (int i = 0; i < bytes.length; i++) { + BigInteger temp = new BigInteger(bytes[i], 16); + byte[] raw = temp.toByteArray(); + result[i] = raw[raw.length - 1]; + } + return result; + } + +} diff --git a/dhcpservice/dhcpservice-api/src/main/yang/dhcpservice-api.yang b/dhcpservice/dhcpservice-api/src/main/yang/dhcpservice-api.yang new file mode 100644 index 00000000..6d45eed9 --- /dev/null +++ b/dhcpservice/dhcpservice-api/src/main/yang/dhcpservice-api.yang @@ -0,0 +1,11 @@ +module dhcpservice-api { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:dhcpservice:api"; + prefix "dhcpservice-api"; + + revision "2015-07-10" { + description + "Initial revision for DHCP Service module"; + } + +} \ No newline at end of file diff --git a/dhcpservice/dhcpservice-impl/pom.xml b/dhcpservice/dhcpservice-impl/pom.xml new file mode 100644 index 00000000..d6c1c00e --- /dev/null +++ b/dhcpservice/dhcpservice-impl/pom.xml @@ -0,0 +1,54 @@ + + + + + + org.opendaylight.vpnservice + config-parent + 0.2.0-SNAPSHOT + ../../commons/config-parent + + + 4.0.0 + org.opendaylight.vpnservice + dhcpservice-impl + ${vpnservices.version} + bundle + + + ${project.groupId} + dhcpservice-api + ${vpnservices.version} + + + org.opendaylight.controller + sal-binding-api + + + org.opendaylight.openflowplugin.model + model-flow-service + ${openflowplugin.version} + + + ${project.groupId} + mdsalutil-api + ${vpnservices.version} + + + org.opendaylight.neutron + model + ${neutron.version} + + + commons-net + commons-net + + + + diff --git a/dhcpservice/dhcpservice-impl/src/main/config/default-config.xml b/dhcpservice/dhcpservice-impl/src/main/config/default-config.xml new file mode 100644 index 00000000..64b2bfaa --- /dev/null +++ b/dhcpservice/dhcpservice-impl/src/main/config/default-config.xml @@ -0,0 +1,43 @@ + + + + + + urn:opendaylight:params:xml:ns:yang:dhcpservice:impl?module=dhcpservice-impl&revision=2015-07-10 + urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28 + urn:opendaylight:params:xml:ns:yang:mdsalutil:api?module=odl-mdsalutil&revision=2015-04-10 + + + + + + + prefix:dhcpservice-impl + dhcpservice-default + + binding:binding-broker-osgi-registry + binding-osgi-broker + + + binding:binding-rpc-registry + binding-rpc-broker + + + binding:binding-notification-service + binding-notification-broker + + + mdsalutil:odl-mdsalutil + mdsalutil-service + + + + + + diff --git a/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpPktHandler.java b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpPktHandler.java new file mode 100644 index 00000000..16a2dc19 --- /dev/null +++ b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpPktHandler.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.vpnservice.dhcpservice; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener; + +public class DhcpPktHandler implements AutoCloseable, PacketProcessingListener { + + private static final Logger LOG = LoggerFactory.getLogger(DhcpPktHandler.class); + private final DataBroker dataBroker; + + public DhcpPktHandler(final DataBroker broker) { + this.dataBroker = broker; + } + + @Override + public void onPacketReceived(PacketReceived pktReceived) { + LOG.info("Pkt received: {}",pktReceived); + } + + @Override + public void close() throws Exception { + // TODO Auto-generated method stub + + } + +} diff --git a/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpProvider.java b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpProvider.java new file mode 100644 index 00000000..7c086c23 --- /dev/null +++ b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/vpnservice/dhcpservice/DhcpProvider.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.vpnservice.dhcpservice; + +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; + +import org.opendaylight.yangtools.concepts.Registration; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; +import org.opendaylight.vpnservice.mdsalutil.interfaces.IMdsalApiManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DhcpProvider implements BindingAwareProvider, AutoCloseable { + + private static final Logger LOG = LoggerFactory.getLogger(DhcpProvider.class); + private IMdsalApiManager mdsalManager; + private DhcpPktHandler dhcpPktHandler; + private Registration packetListener = null; + private NotificationProviderService notificationService; + + @Override + public void onSessionInitiated(ProviderContext session) { + LOG.info("DhcpProvider Session Initiated"); + try { + final DataBroker dataBroker = session.getSALService(DataBroker.class); + dhcpPktHandler = new DhcpPktHandler(dataBroker); + packetListener = notificationService.registerNotificationListener(dhcpPktHandler); + } catch (Exception e) { + LOG.error("Error initializing services", e); + } + } + + + public void setMdsalManager(IMdsalApiManager mdsalManager) { + this.mdsalManager = mdsalManager; + } + + @Override + public void close() throws Exception { + if(packetListener != null) { + packetListener.close(); + } + if(dhcpPktHandler != null) { + dhcpPktHandler.close(); + } + LOG.info("DhcpProvider closed"); + } + + public void setNotificationProviderService(NotificationProviderService notificationServiceDependency) { + this.notificationService = notificationServiceDependency; + } + +} diff --git a/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModule.java b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModule.java new file mode 100644 index 00000000..9fbd12c8 --- /dev/null +++ b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModule.java @@ -0,0 +1,27 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.impl.rev150710; + +import org.opendaylight.vpnservice.dhcpservice.DhcpProvider; + +public class DhcpServiceImplModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.impl.rev150710.AbstractDhcpServiceImplModule { + public DhcpServiceImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public DhcpServiceImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.impl.rev150710.DhcpServiceImplModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + DhcpProvider dhcpProvider = new DhcpProvider(); + dhcpProvider.setNotificationProviderService(getNotificationServiceDependency()); + getBrokerDependency().registerProvider(dhcpProvider); + return dhcpProvider; + } + +} diff --git a/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModuleFactory.java b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModuleFactory.java new file mode 100644 index 00000000..09562b03 --- /dev/null +++ b/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/dhcpservice/impl/rev150710/DhcpServiceImplModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: dhcpservice-impl yang module local name: dhcpservice-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Sat Jul 11 21:38:25 IST 2015 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.impl.rev150710; +public class DhcpServiceImplModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.impl.rev150710.AbstractDhcpServiceImplModuleFactory { + +} diff --git a/dhcpservice/dhcpservice-impl/src/main/yang/dhcpservice-impl.yang b/dhcpservice/dhcpservice-impl/src/main/yang/dhcpservice-impl.yang new file mode 100644 index 00000000..dcbec022 --- /dev/null +++ b/dhcpservice/dhcpservice-impl/src/main/yang/dhcpservice-impl.yang @@ -0,0 +1,61 @@ +module dhcpservice-impl { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:dhcpservice:impl"; + prefix "dhcpservice-impl"; + + import config { prefix config; revision-date 2013-04-05; } + import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;} + import odl-mdsalutil { prefix odl-mdsal; revision-date 2015-04-10;} + + description + "Service definition for dhcpservice project"; + + revision "2015-07-10" { + description + "Initial revision"; + } + + identity dhcpservice-impl { + base config:module-type; + config:java-name-prefix DhcpServiceImpl; + } + + augment "/config:modules/config:module/config:configuration" { + case dhcpservice-impl { + when "/config:modules/config:module/config:type = 'dhcpservice-impl'"; + container broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity md-sal-binding:binding-broker-osgi-registry; + } + } + } + container rpcregistry { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity md-sal-binding:binding-rpc-registry; + } + } + } + container notification-service { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity md-sal-binding:binding-notification-service; + } + } + } + + container mdsalutil { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity odl-mdsal:odl-mdsalutil; + } + } + } + } + } +} diff --git a/dhcpservice/pom.xml b/dhcpservice/pom.xml new file mode 100644 index 00000000..dc166783 --- /dev/null +++ b/dhcpservice/pom.xml @@ -0,0 +1,49 @@ + + + + + + org.opendaylight.odlparent + odlparent + 1.6.0-SNAPSHOT + + + + org.opendaylight.vpnservice + dhcpservice-aggregator + 0.2.0-SNAPSHOT + dhcpservice + pom + 4.0.0 + + 3.1.1 + + + dhcpservice-api + dhcpservice-impl + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + diff --git a/features/pom.xml b/features/pom.xml index 4fae2518..a16ee561 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -36,7 +36,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL ${vpnservices.version} ${vpnservices.version} ${vpnservices.version} - ${vpnservices.version} + ${vpnservices.version} @@ -196,7 +196,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL model-bgp 2013.07.15.8-SNAPSHOT - + ${project.groupId} nexthopmgr-impl ${nexthopmgr.version} @@ -213,7 +213,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL nexthopmgr-api ${nexthopmgr.version} - + ${project.groupId} fibmanager-impl ${fibmanager.version} @@ -264,7 +264,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL idmanager-api ${idmanager.version} - + org.opendaylight.vpnservice itm-impl ${itm.version} @@ -276,6 +276,23 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL config xml + + ${project.groupId} + dhcpservice-impl + ${vpnservices.version} + + + ${project.groupId} + dhcpservice-impl + ${vpnservices.version} + config + xml + + + ${project.groupId} + dhcpservice-api + ${vpnservices.version} + org.apache.thrift libthrift diff --git a/features/src/main/features/features.xml b/features/src/main/features/features.xml index c7167833..6f116b55 100644 --- a/features/src/main/features/features.xml +++ b/features/src/main/features/features.xml @@ -28,6 +28,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html mvn:org.opendaylight.vpnservice/nexthopmgr-api/${nexthopmgr.version} mvn:org.opendaylight.vpnservice/fibmanager-api/${fibmanager.version} mvn:org.opendaylight.vpnservice/itm-api/${itm.version} + mvn:org.opendaylight.vpnservice/dhcpservice-api/${vpnservices.version} odl-mdsal-broker @@ -48,12 +49,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html mvn:org.opendaylight.vpnservice/nexthopmgr-impl/${nexthopmgr.version} mvn:org.opendaylight.vpnservice/fibmanager-impl/${fibmanager.version} mvn:org.opendaylight.vpnservice/itm-impl/${itm.version} - + mvn:org.opendaylight.vpnservice/dhcpservice-impl/${vpnservices.version} + wrap:mvn:org.apache.thrift/libthrift/0.9.1$overwrite=merge&Bundle-Version=0.9.1&Export-Package=*;-noimport:=true;version="0.9.1" mvn:org.opendaylight.vpnservice/lockmanager-impl/${lockmanager.version}/xml/config - mvn:org.opendaylight.vpnservice/idmanager-impl/${idmanager.version}/xml/config + mvn:org.opendaylight.vpnservice/idmanager-impl/${idmanager.version}/xml/config + mvn:org.opendaylight.vpnservice/idmanager-impl/${idmanager.version}/xml/config mvn:org.opendaylight.vpnservice/bgpmanager-impl/${vpnservices.version}/xml/config mvn:org.opendaylight.vpnservice/mdsalutil-impl/${interfacemgr.version}/xml/config mvn:org.opendaylight.vpnservice/interfacemgr-impl/${interfacemgr.version}/xml/config @@ -62,7 +65,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html mvn:org.opendaylight.vpnservice/nexthopmgr-impl/${nexthopmgr.version}/xml/config mvn:org.opendaylight.vpnservice/fibmanager-impl/${fibmanager.version}/xml/config mvn:org.opendaylight.vpnservice/itm-impl/${itm.version}/xml/config - + mvn:org.opendaylight.vpnservice/dhcpservice-impl/${vpnservices.version}/xml/config odl-vpnservice-impl diff --git a/pom.xml b/pom.xml index 4e9b4dd3..8b3fc8bf 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL nexthopmgr fibmanager bgpmanager + dhcpservice itm distribution/karaf features -- 2.36.6