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
alshabib
2014-09-11 11:22:33 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
51622f7440b1859a616b75790d5dbadb0d198211
51622f74
1 parent
e5652756
support for of1.3 switches
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
of/api/src/main/java/org/onlab/onos/of/controller/DefaultPacketContext.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
View file @
51622f7
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_ADDED
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_MOVED
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_REMOVED
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_UPDATED
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.DefaultHost
;
import
org.onlab.onos.net.DeviceId
;
...
...
@@ -15,17 +26,6 @@ import com.google.common.collect.HashMultimap;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.collect.Multimap
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_REMOVED
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_ADDED
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_UPDATED
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_MOVED
;
/**
* Manages inventory of end-station hosts using trivial in-memory
* implementation.
...
...
@@ -46,7 +46,7 @@ public class SimpleHostStore {
* @return appropriate event or null if no change resulted
*/
HostEvent
createOrUpdateHost
(
ProviderId
providerId
,
HostId
hostId
,
HostDescription
hostDescription
)
{
HostDescription
hostDescription
)
{
Host
host
=
hosts
.
get
(
hostId
);
if
(
host
==
null
)
{
return
createHost
(
providerId
,
hostId
,
hostDescription
);
...
...
@@ -62,7 +62,7 @@ public class SimpleHostStore {
descr
.
vlan
(),
descr
.
location
(),
descr
.
ipAddresses
());
synchronized
(
this
)
{
synchronized
(
this
)
{
hosts
.
put
(
hostId
,
newhost
);
locations
.
put
(
descr
.
location
(),
newhost
);
}
...
...
@@ -104,7 +104,7 @@ public class SimpleHostStore {
* @return remove even or null if host was not found
*/
HostEvent
removeHost
(
HostId
hostId
)
{
synchronized
(
this
)
{
synchronized
(
this
)
{
Host
host
=
hosts
.
remove
(
hostId
);
if
(
host
!=
null
)
{
locations
.
remove
((
host
.
location
()),
host
);
...
...
@@ -216,4 +216,4 @@ public class SimpleHostStore {
return
hostset
;
}
}
\ No newline at end of file
}
...
...
of/api/src/main/java/org/onlab/onos/of/controller/DefaultPacketContext.java
View file @
51622f7
...
...
@@ -7,6 +7,7 @@ import org.projectfloodlight.openflow.protocol.OFPacketIn;
import
org.projectfloodlight.openflow.protocol.OFPacketOut
;
import
org.projectfloodlight.openflow.protocol.action.OFAction
;
import
org.projectfloodlight.openflow.protocol.action.OFActionOutput
;
import
org.projectfloodlight.openflow.protocol.match.MatchField
;
import
org.projectfloodlight.openflow.types.OFBufferId
;
import
org.projectfloodlight.openflow.types.OFPort
;
...
...
@@ -83,12 +84,18 @@ public final class DefaultPacketContext implements PacketContext {
@Override
public
Integer
inPort
()
{
return
pktin
.
getInPort
().
getPortNumber
();
try
{
return
pktin
.
getInPort
().
getPortNumber
();
}
catch
(
UnsupportedOperationException
e
)
{
return
pktin
.
getMatch
().
get
(
MatchField
.
IN_PORT
).
getPortNumber
();
}
}
@Override
public
byte
[]
unparsed
()
{
return
pktin
.
getData
().
clone
();
}
private
OFActionOutput
buildOutput
(
Integer
port
)
{
...
...
Please
register
or
login
to post a comment