Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Mahesh Poojary Huawei
2015-11-05 11:28:01 +0530
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f5f1edd45e3801313dc6a3d9d7c5a1e1c2893740
f5f1edd4
1 parent
d0b1d13a
[ONOS-3116] PortPairGroupId
Change-Id: I213b6638bacfe716b87393a447b0f4634f6a4c5b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
18 deletions
apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java
apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java
apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortChainCodec.java
apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairGroupCodec.java
apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java
View file @
f5f1edd
...
...
@@ -19,8 +19,7 @@ import static com.google.common.base.MoreObjects.toStringHelper;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkNotNull
;
import
java.util.UUID
;
import
com.google.common.base.Objects
;
import
java.util.Objects
;
/**
* Representation of a Port Pair Group ID.
...
...
@@ -40,22 +39,22 @@ public final class PortPairGroupId {
}
/**
*
Constructor to create port pair group id from UUID
.
*
Returns newly created port pair group id object
.
*
* @param id
UUID of port pair group id
* @param id
port pair group id in UUID
* @return object of port pair group id
*/
public
static
PortPairGroupId
portPairGroupId
(
UUID
id
)
{
public
static
PortPairGroupId
of
(
UUID
id
)
{
return
new
PortPairGroupId
(
id
);
}
/**
*
Constructor to create port pair group id from string
.
*
Returns newly created port pair group id object
.
*
* @param id port pair group id in string
* @return object of port pair group id
*/
public
static
PortPairGroupId
portPairGroupId
(
String
id
)
{
public
static
PortPairGroupId
of
(
String
id
)
{
return
new
PortPairGroupId
(
UUID
.
fromString
(
id
));
}
...
...
@@ -73,10 +72,9 @@ public final class PortPairGroupId {
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
.
getClass
()
==
this
.
getClass
())
{
PortPairGroupId
that
=
(
PortPairGroupId
)
obj
;
return
Objects
.
equal
(
this
.
portPairGroupId
,
that
.
portPairGroupId
);
if
(
obj
instanceof
PortPairGroupId
)
{
final
PortPairGroupId
other
=
(
PortPairGroupId
)
obj
;
return
Objects
.
equals
(
this
.
portPairGroupId
,
other
.
portPairGroupId
);
}
return
false
;
}
...
...
@@ -88,8 +86,7 @@ public final class PortPairGroupId {
@Override
public
String
toString
()
{
return
toStringHelper
(
this
)
.
add
(
"portPairGroupId"
,
portPairGroupId
.
toString
())
return
toStringHelper
(
this
).
add
(
"portPairGroupId"
,
portPairGroupId
)
.
toString
();
}
}
...
...
apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java
View file @
f5f1edd
...
...
@@ -83,11 +83,11 @@ public class PortPairGroupWebResource extends AbstractWebResource {
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Response
getPortPairGroup
(
@PathParam
(
"group_id"
)
String
id
)
{
if
(!
service
.
exists
(
PortPairGroupId
.
portPairGroupId
(
id
)))
{
if
(!
service
.
exists
(
PortPairGroupId
.
of
(
id
)))
{
return
Response
.
status
(
NOT_FOUND
)
.
entity
(
PORT_PAIR_GROUP_NOT_FOUND
).
build
();
}
PortPairGroup
portPairGroup
=
nullIsNotFound
(
service
.
getPortPairGroup
(
PortPairGroupId
.
portPairGroupId
(
id
)),
PortPairGroup
portPairGroup
=
nullIsNotFound
(
service
.
getPortPairGroup
(
PortPairGroupId
.
of
(
id
)),
PORT_PAIR_GROUP_NOT_FOUND
);
ObjectNode
result
=
new
ObjectMapper
().
createObjectNode
();
...
...
@@ -153,7 +153,7 @@ public class PortPairGroupWebResource extends AbstractWebResource {
@DELETE
public
void
deletePortPairGroup
(
@PathParam
(
"group_id"
)
String
id
)
{
log
.
debug
(
"Deletes port pair group by identifier {}."
,
id
);
PortPairGroupId
portPairGroupId
=
PortPairGroupId
.
portPairGroupId
(
id
);
PortPairGroupId
portPairGroupId
=
PortPairGroupId
.
of
(
id
);
Boolean
issuccess
=
nullIsNotFound
(
service
.
removePortPairGroup
(
portPairGroupId
),
PORT_PAIR_GROUP_NOT_FOUND
);
if
(!
issuccess
)
{
...
...
apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortChainCodec.java
View file @
f5f1edd
...
...
@@ -76,7 +76,7 @@ public final class PortChainCodec extends JsonCodec<PortChain> {
ArrayNode
arrayNode
=
(
ArrayNode
)
json
.
path
(
PORT_PAIR_GROUPS
);
if
(
arrayNode
!=
null
)
{
List
<
PortPairGroupId
>
list
=
Lists
.
newArrayList
();
arrayNode
.
forEach
(
i
->
list
.
add
(
PortPairGroupId
.
portPairGroupId
(
i
.
asText
())));
arrayNode
.
forEach
(
i
->
list
.
add
(
PortPairGroupId
.
of
(
i
.
asText
())));
resultBuilder
.
setPortPairGroups
(
list
);
}
...
...
apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairGroupCodec.java
View file @
f5f1edd
...
...
@@ -59,7 +59,7 @@ public final class PortPairGroupCodec extends JsonCodec<PortPairGroup> {
String
id
=
nullIsIllegal
(
json
.
get
(
ID
),
ID
+
MISSING_MEMBER_MESSAGE
).
asText
();
resultBuilder
.
setId
(
PortPairGroupId
.
portPairGroupId
(
id
));
resultBuilder
.
setId
(
PortPairGroupId
.
of
(
id
));
String
tenantId
=
nullIsIllegal
(
json
.
get
(
TENANT_ID
),
TENANT_ID
+
MISSING_MEMBER_MESSAGE
).
asText
();
...
...
Please
register
or
login
to post a comment