Open Kilda Java Documentation
UniFlowVerificationRequest.java
Go to the documentation of this file.
1 /* Copyright 2018 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.command.flow;
17 
21 
22 import com.fasterxml.jackson.annotation.JsonCreator;
23 import com.fasterxml.jackson.annotation.JsonInclude;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
26 import lombok.Value;
27 
28 import java.util.UUID;
29 
30 @Value
31 @JsonSerialize
32 @JsonInclude(JsonInclude.Include.NON_NULL)
34  @JsonProperty("packet_id")
35  private final UUID packetId;
36 
37  @JsonProperty("timeout")
38  private int timeout;
39 
40  @JsonProperty("flow_id")
41  private String flowId;
42 
43  @JsonProperty("direction")
44  private FlowDirection direction;
45 
46  @JsonProperty("source_switch")
47  private SwitchId sourceSwitchId;
48 
49  @JsonProperty("source_port")
50  private int sourcePort;
51 
52  @JsonProperty("dest_switch")
53  private SwitchId destSwitchId;
54 
55  @JsonProperty("vlan")
56  private int vlanId;
57 
58  @JsonCreator
60  @JsonProperty("packet_id") UUID packetId,
61  @JsonProperty("timeout") int timeout,
62  @JsonProperty("flow_id") String flowId,
63  @JsonProperty("direction") FlowDirection direction,
64  @JsonProperty("source_switch") SwitchId sourceSwitchId,
65  @JsonProperty("source_port") int sourcePort,
66  @JsonProperty("dest_switch") SwitchId destSwitchId,
67  @JsonProperty("vlan") int vlanId) {
68  if (packetId == null) {
69  packetId = UUID.randomUUID();
70  }
71  this.packetId = packetId;
72  this.timeout = timeout;
73 
74  this.flowId = flowId;
75  this.direction = direction;
76  this.sourceSwitchId = sourceSwitchId;
77  this.sourcePort = sourcePort;
78  this.destSwitchId = destSwitchId;
79  this.vlanId = vlanId;
80  }
81 
83  this(
84  null,
85  request.getTimeout(),
86  flow.getFlowId(),
87  direction,
88  flow.getSourceSwitch(), flow.getSourcePort(),
89  flow.getDestinationSwitch(),
90  flow.getSourceVlan());
91  }
92 }
UniFlowVerificationRequest(FlowVerificationRequest request, Flow flow, FlowDirection direction)
UniFlowVerificationRequest( @JsonProperty("packet_id") UUID packetId, @JsonProperty("timeout") int timeout, @JsonProperty("flow_id") String flowId, @JsonProperty("direction") FlowDirection direction, @JsonProperty("source_switch") SwitchId sourceSwitchId, @JsonProperty("source_port") int sourcePort, @JsonProperty("dest_switch") SwitchId destSwitchId, @JsonProperty("vlan") int vlanId)