2 * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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
8 package org.opendaylight.netvirt.dhcpservice;
10 import java.util.ArrayList;
11 import java.util.List;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnet.attributes.HostRoutes;
16 public class DhcpInfo {
17 private String clientIp;
18 private String serverIp;
19 private String gatewayIp;
21 private List<String> dnsServers;
22 private List<HostRoutes> hostRoutes;
28 protected DhcpInfo setClientIp(String clientIp) {
29 this.clientIp = clientIp;
33 protected DhcpInfo setCidr(String cidr) {
38 protected DhcpInfo setServerIp(String serverIp) {
39 this.serverIp = serverIp;
43 protected DhcpInfo setGatewayIp(String gwIp) {
48 protected DhcpInfo setHostRoutes(List<HostRoutes> hostRoutes) {
49 this.hostRoutes = hostRoutes;
53 protected DhcpInfo setDnsServers(List<String> dnsServers) {
54 this.dnsServers = dnsServers;
58 protected DhcpInfo setDnsServersIpAddrs(List<IpAddress> dnsServersIpAddrs) {
59 for (IpAddress ipAddr: dnsServersIpAddrs) {
60 addDnsServer(ipAddr.getIpv4Address().getValue());
65 protected DhcpInfo addDnsServer(String dnsServerIp) {
66 if (dnsServers == null) {
67 dnsServers = new ArrayList<>();
69 dnsServers.add(dnsServerIp);
74 protected String getClientIp() {
78 protected String getCidr() {
82 protected String getServerIp() {
86 protected String getGatewayIp() {
90 protected List<String> getDnsServers() {
94 protected List<HostRoutes> getHostRoutes() {