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
tom
2014-10-09 13:50:45 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1679e18072eaca75756914b6e39b8c014c58e475
1679e180
1 parent
3f146400
Eliminating some performance bottlenecks; more to be done.
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
45 deletions
apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
core/api/src/main/java/org/onlab/onos/net/ElementId.java
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
View file @
1679e18
...
...
@@ -170,7 +170,9 @@ public class ReactiveForwarding {
// We don't yet support bufferids in the flowservice so packet out first.
packetOut
(
context
,
portNumber
);
if
(
true
)
{
return
;
}
// Install the flow rule to handle this type of message from now on.
Ethernet
inPkt
=
context
.
inPacket
().
parsed
();
...
...
cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
View file @
1679e18
...
...
@@ -19,17 +19,16 @@ import org.onlab.onos.net.intent.IntentState;
description
=
"Wipes-out the entire network information base, i.e. devices, links, hosts"
)
public
class
WipeOutCommand
extends
ClustersListCommand
{
private
static
final
String
DISCLAIMER
=
"Delete everything please.
"
;
private
static
final
String
PLEASE
=
"please
"
;
@Argument
(
index
=
0
,
name
=
"
disclaimer"
,
description
=
"Device ID
"
,
@Argument
(
index
=
0
,
name
=
"
please"
,
description
=
"Confirmation phrase
"
,
required
=
false
,
multiValued
=
false
)
String
disclaimer
=
null
;
String
please
=
null
;
@Override
protected
void
execute
()
{
if
(
disclaimer
==
null
||
!
disclaimer
.
equals
(
DISCLAIMER
))
{
print
(
"I'm afraid I can't do that!\nPlease acknowledge with phrase: '%s'"
,
DISCLAIMER
);
if
(
please
==
null
||
!
please
.
equals
(
PLEASE
))
{
print
(
"I'm afraid I can't do that!\nSay: %s"
,
PLEASE
);
return
;
}
...
...
core/api/src/main/java/org/onlab/onos/net/ElementId.java
View file @
1679e18
...
...
@@ -9,10 +9,12 @@ import java.util.Objects;
public
abstract
class
ElementId
{
private
final
URI
uri
;
private
final
String
str
;
// Default constructor for serialization
protected
ElementId
()
{
this
.
uri
=
null
;
this
.
str
=
null
;
}
/**
...
...
@@ -22,6 +24,7 @@ public abstract class ElementId {
*/
protected
ElementId
(
URI
uri
)
{
this
.
uri
=
uri
;
this
.
str
=
uri
.
toString
();
}
/**
...
...
@@ -35,7 +38,7 @@ public abstract class ElementId {
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
uri
);
return
Objects
.
hash
(
str
);
}
@Override
...
...
@@ -46,14 +49,14 @@ public abstract class ElementId {
if
(
obj
instanceof
ElementId
)
{
final
ElementId
that
=
(
ElementId
)
obj
;
return
this
.
getClass
()
==
that
.
getClass
()
&&
Objects
.
equals
(
this
.
uri
,
that
.
uri
);
Objects
.
equals
(
this
.
str
,
that
.
str
);
}
return
false
;
}
@Override
public
String
toString
()
{
return
uri
.
toString
()
;
return
str
;
}
}
...
...
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
View file @
1679e18
package
org
.
onlab
.
onos
.
net
.
flow
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.Collections
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Objects
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.instructions.Instruction
;
import
org.onlab.onos.net.flow.instructions.Instructions
;
import
org.onlab.packet.IpPrefix
;
import
org.onlab.packet.MacAddress
;
import
org.onlab.packet.VlanId
;
import
org.slf4j.Logger
;
import
java.util.Collections
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Objects
;
/**
* Default traffic treatment implementation.
...
...
@@ -58,7 +55,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
}
if
(
obj
instanceof
DefaultTrafficTreatment
)
{
DefaultTrafficTreatment
that
=
(
DefaultTrafficTreatment
)
obj
;
return
Objects
.
equals
(
instructions
,
that
.
instructions
);
return
Objects
.
equals
(
instructions
,
that
.
instructions
);
}
return
false
;
...
...
@@ -70,8 +67,6 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
*/
public
static
final
class
Builder
implements
TrafficTreatment
.
Builder
{
private
final
Logger
log
=
getLogger
(
getClass
());
boolean
drop
=
false
;
List
<
Instruction
>
outputs
=
new
LinkedList
<>();
...
...
@@ -107,7 +102,8 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
groups
.
add
(
instruction
);
break
;
default
:
log
.
warn
(
"Unknown instruction type {}"
,
instruction
.
type
());
throw
new
IllegalArgumentException
(
"Unknown instruction type: "
+
instruction
.
type
());
}
return
this
;
}
...
...
openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
View file @
1679e18
package
org
.
onlab
.
onos
.
openflow
.
controller
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.Collections
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
org.onlab.packet.Ethernet
;
import
org.projectfloodlight.openflow.protocol.OFPacketIn
;
import
org.projectfloodlight.openflow.protocol.OFPacketOut
;
...
...
@@ -13,11 +8,11 @@ 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
;
import
org.slf4j.Logger
;
public
final
class
DefaultOpenFlowPacketContext
implements
OpenFlowPacketContext
{
import
java.util.Collections
;
import
java.util.concurrent.atomic.AtomicBoolean
;
private
final
Logger
log
=
getLogger
(
getClass
());
public
final
class
DefaultOpenFlowPacketContext
implements
OpenFlowPacketContext
{
private
final
AtomicBoolean
free
=
new
AtomicBoolean
(
true
);
private
final
AtomicBoolean
isBuilt
=
new
AtomicBoolean
(
false
);
...
...
@@ -82,7 +77,7 @@ public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext
}
public
static
OpenFlowPacketContext
packetContextFromPacketIn
(
OpenFlowSwitch
s
,
OFPacketIn
pkt
)
{
OFPacketIn
pkt
)
{
return
new
DefaultOpenFlowPacketContext
(
s
,
pkt
);
}
...
...
openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
View file @
1679e18
...
...
@@ -157,9 +157,7 @@ public class Controller {
}
log
.
debug
(
"OpenFlow port set to {}"
,
this
.
openFlowPort
);
String
threads
=
configParams
.
get
(
"workerthreads"
);
if
(
threads
!=
null
)
{
this
.
workerThreads
=
Integer
.
parseInt
(
threads
);
}
this
.
workerThreads
=
threads
!=
null
?
Integer
.
parseInt
(
threads
)
:
16
;
log
.
debug
(
"Number of worker threads set to {}"
,
this
.
workerThreads
);
}
...
...
openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
View file @
1679e18
...
...
@@ -44,7 +44,6 @@ public class OpenFlowControllerImpl implements OpenFlowController {
private
final
ExecutorService
executor
=
Executors
.
newFixedThreadPool
(
16
,
namedThreads
(
"of-event-%d"
));
protected
ConcurrentHashMap
<
Dpid
,
OpenFlowSwitch
>
connectedSwitches
=
new
ConcurrentHashMap
<
Dpid
,
OpenFlowSwitch
>();
protected
ConcurrentHashMap
<
Dpid
,
OpenFlowSwitch
>
activeMasterSwitches
=
...
...
providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
View file @
1679e18
package
org
.
onlab
.
onos
.
provider
.
of
.
packet
.
impl
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.List
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.instructions.Instruction
;
import
org.onlab.onos.net.flow.instructions.Instruction.Type
;
...
...
@@ -14,16 +10,16 @@ import org.onlab.onos.net.packet.OutboundPacket;
import
org.onlab.onos.openflow.controller.OpenFlowPacketContext
;
import
org.onlab.packet.Ethernet
;
import
org.projectfloodlight.openflow.types.OFPort
;
import
org.slf4j.Logger
;
public
class
OpenFlowCorePacketContext
extends
DefaultPacketContext
{
import
java.util.List
;
private
final
Logger
log
=
getLogger
(
getClass
());
public
class
OpenFlowCorePacketContext
extends
DefaultPacketContext
{
private
final
OpenFlowPacketContext
ofPktCtx
;
protected
OpenFlowCorePacketContext
(
long
time
,
InboundPacket
inPkt
,
OutboundPacket
outPkt
,
boolean
block
,
OpenFlowPacketContext
ofPktCtx
)
{
OutboundPacket
outPkt
,
boolean
block
,
OpenFlowPacketContext
ofPktCtx
)
{
super
(
time
,
inPkt
,
outPkt
,
block
);
this
.
ofPktCtx
=
ofPktCtx
;
}
...
...
@@ -36,9 +32,8 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext {
}
else
{
Ethernet
eth
=
new
Ethernet
();
eth
.
deserialize
(
outPacket
().
data
().
array
(),
0
,
outPacket
().
data
().
array
().
length
);
outPacket
().
data
().
array
().
length
);
sendPacket
(
eth
);
}
}
...
...
@@ -61,6 +56,7 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext {
}
ofPktCtx
.
send
();
}
private
OFPort
buildPort
(
PortNumber
port
)
{
return
OFPort
.
of
((
int
)
port
.
toLong
());
}
...
...
Please
register
or
login
to post a comment