2 * Copyright (c) 2016 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.elan.arp.responder;
10 import com.google.common.base.Strings;
11 import java.math.BigInteger;
12 import java.util.Collections;
13 import java.util.List;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
17 public final class ArpResponderInput {
19 private BigInteger dpId;
20 private String interfaceName;
24 private List<Instruction> instructions;
26 private ArpResponderInput() {
30 public BigInteger getDpId() {
34 public String getInterfaceName() {
38 public String getSpa() {
42 public String getSha() {
46 public int getLportTag() {
50 public List<Instruction> getInstructions() {
51 if (instructions == null) {
52 instructions = Collections.emptyList();
57 public static class ArpReponderInputBuilder {
59 private ArpResponderInput input;
61 public ArpReponderInputBuilder() {
62 input = new ArpResponderInput();
65 public ArpResponderInput build() {
69 public ArpResponderInput buildForInstallFlow() {
71 if (input.dpId == null || Strings.isNullOrEmpty(input.interfaceName) || Strings.isNullOrEmpty(input.spa)
72 || Strings.isNullOrEmpty(input.sha) || input.lportTag == 0
73 || input.instructions == null || input.instructions.isEmpty()) {
74 throw new AssertionError("Missing mandatory fields for ARP Responder Install Flow");
80 public ArpResponderInput buildForRemoveFlow() {
82 if (input.dpId == null || Strings.isNullOrEmpty(input.interfaceName) || Strings.isNullOrEmpty(input.spa)
83 || input.lportTag == 0) {
84 throw new AssertionError("Missing mandatory fields for ARP Responder Install Flow");
90 public ArpReponderInputBuilder(ArpResponderInput input) {
94 public ArpReponderInputBuilder setDpId(BigInteger dpId) {
99 public ArpReponderInputBuilder setInterfaceName(String interfaceName) {
100 input.interfaceName = interfaceName;
104 public ArpReponderInputBuilder setSpa(String spa) {
109 public ArpReponderInputBuilder setSha(String sha) {
114 public ArpReponderInputBuilder setLportTag(int lportTag) {
115 input.lportTag = lportTag;
119 public ArpReponderInputBuilder setInstructions(List<Instruction> instructions) {
120 input.instructions = instructions == null ? Collections.emptyList() : instructions;