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;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnet.attributes.HostRoutes;
15 public class DhcpInfo {
16 private String clientIp;
17 private String serverIp;
18 private String gatewayIp;
20 private List<String> dnsServers;
21 private List<HostRoutes> hostRoutes;
27 protected DhcpInfo setClientIp(String clientIp) {
28 this.clientIp = clientIp;
32 protected DhcpInfo setCidr(String cidr) {
37 protected DhcpInfo setServerIp(String serverIp) {
38 this.serverIp = serverIp;
42 protected DhcpInfo setGatewayIp(String gwIp) {
47 protected DhcpInfo setHostRoutes(List<HostRoutes> hostRoutes) {
48 this.hostRoutes = hostRoutes;
52 protected DhcpInfo setDnsServersIpAddrs(List<IpAddress> dnsServersIpAddrs) {
53 for (IpAddress ipAddr: dnsServersIpAddrs) {
54 addDnsServer(ipAddr.getIpv4Address().getValue());
59 protected DhcpInfo addDnsServer(String dnsServerIp) {
60 if (dnsServers == null) {
61 dnsServers = new ArrayList<>();
63 dnsServers.add(dnsServerIp);
68 protected String getClientIp() {
72 protected String getCidr() {
76 protected String getServerIp() {
80 protected String getGatewayIp() {
84 protected List<String> getDnsServers() {
88 protected List<HostRoutes> getHostRoutes() {