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-16 11:59:31 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
55a55d9140d11033d0d6f3bbbba1d57e08443c4a
55a55d91
1 parent
7d2e4af1
fix for cbench
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
195 additions
and
9 deletions
apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
core/api/src/main/java/org/onlab/onos/net/flow/TrafficTreatment.java
core/api/src/main/java/org/onlab/onos/net/flow/Instruction.java → core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instruction.java
core/api/src/main/java/org/onlab/onos/net/flow/Instructions.java → core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java
core/api/src/main/java/org/onlab/onos/net/flow/instructions/L2ModificationInstruction.java
of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
of/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java
providers/of/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 @
55a55d9
...
...
@@ -9,7 +9,7 @@ import org.onlab.onos.net.Host;
import
org.onlab.onos.net.HostId
;
import
org.onlab.onos.net.Path
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.Instructions
;
import
org.onlab.onos.net.flow.
instructions.
Instructions
;
import
org.onlab.onos.net.host.HostService
;
import
org.onlab.onos.net.packet.InboundPacket
;
import
org.onlab.onos.net.packet.PacketContext
;
...
...
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
View file @
55a55d9
...
...
@@ -6,6 +6,7 @@ import java.util.Collections;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.onlab.onos.net.flow.instructions.Instruction
;
import
org.slf4j.Logger
;
@SuppressWarnings
(
"rawtypes"
)
...
...
core/api/src/main/java/org/onlab/onos/net/flow/TrafficTreatment.java
View file @
55a55d9
...
...
@@ -2,6 +2,8 @@ package org.onlab.onos.net.flow;
import
java.util.List
;
import
org.onlab.onos.net.flow.instructions.Instruction
;
/**
* Abstraction of network traffic treatment.
*/
...
...
core/api/src/main/java/org/onlab/onos/net/flow/Instruction.java
→
core/api/src/main/java/org/onlab/onos/net/flow/
instructions/
Instruction.java
View file @
55a55d9
package
org
.
onlab
.
onos
.
net
.
flow
;
package
org
.
onlab
.
onos
.
net
.
flow
.
instructions
;
/**
* Abstraction of a single traffic treatment step.
...
...
core/api/src/main/java/org/onlab/onos/net/flow/Instructions.java
→
core/api/src/main/java/org/onlab/onos/net/flow/
instructions/
Instructions.java
View file @
55a55d9
package
org
.
onlab
.
onos
.
net
.
flow
;
package
org
.
onlab
.
onos
.
net
.
flow
.
instructions
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkNotNull
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction
;
import
org.onlab.onos.net.flow.instructions.L2ModificationInstruction.SubType
;
import
org.onlab.packet.MACAddress
;
/**
* Factory class for creating various traffic treatment instructions.
*/
public
final
class
Instructions
{
// Ban construction
private
Instructions
()
{}
...
...
@@ -23,12 +27,52 @@ public final class Instructions {
return
new
OutputInstruction
(
number
);
}
// TODO: Move these out into separate classes and to flow.instruction package
/**
* Creates a drop instruction.
* @return drop instruction
*/
public
static
DropInstruction
createDrop
()
{
return
new
DropInstruction
();
}
// TODO: add create methods
/**
* Creates a l2 src modification.
* @param addr the mac address to modify to.
* @return a l2 modification
*/
public
static
L2ModificationInstruction
modL2Src
(
MACAddress
addr
)
{
checkNotNull
(
addr
,
"Src l2 address cannot be null"
);
return
new
ModEtherInstruction
(
SubType
.
L2_SRC
,
addr
);
}
/**
* Creates a L2 dst modification.
* @param addr the mac address to modify to.
* @return a L2 modification
*/
public
static
L2ModificationInstruction
modL2Dst
(
MACAddress
addr
)
{
checkNotNull
(
addr
,
"Dst l2 address cannot be null"
);
return
new
L2ModificationInstruction
.
ModEtherInstruction
(
SubType
.
L2_DST
,
addr
);
}
/**
* Creates a L2 type modification.
* @param l2Type the type to change to
* @return a L2 modifications
*/
public
static
L2ModificationInstruction
modL2Type
(
Short
l2Type
)
{
checkNotNull
(
l2Type
,
"L2 type cannot be null"
);
return
new
L2ModificationInstruction
.
ModEtherTypeInstruction
(
l2Type
);
}
public
static
L2ModificationInstruction
modVlanId
(
Short
vlanId
)
{
checkNotNull
(
vlanId
,
"VLAN id cannot be null"
);
return
new
L2ModificationInstruction
.
ModVlanIdInstruction
(
vlanId
);
}
/*
* Output instructions
*/
public
static
final
class
DropInstruction
implements
Instruction
{
@Override
...
...
core/api/src/main/java/org/onlab/onos/net/flow/instructions/L2ModificationInstruction.java
0 → 100644
View file @
55a55d9
package
org
.
onlab
.
onos
.
net
.
flow
.
instructions
;
import
org.onlab.packet.MACAddress
;
/**
* Abstraction of a single traffic treatment step.
* @param <T> the type parameter for the instruction
*/
public
abstract
class
L2ModificationInstruction
implements
Instruction
{
/**
* Represents the type of traffic treatment.
*/
public
enum
SubType
{
/**
* Ether src modification.
*/
L2_SRC
,
/**
* Ether dst modification.
*/
L2_DST
,
/**
* Ethertype modification.
*/
L2_TYPE
,
/**
* VLAN id modification.
*/
VLAN_ID
,
/**
* VLAN priority modification.
*/
VLAN_PCP
}
// TODO: Create factory class 'Instructions' that will have various factory
// to create specific instructions.
/**
* Returns the subtype of the modification instruction.
* @return type of instruction
*/
public
abstract
SubType
subtype
();
@Override
public
Type
type
()
{
return
Type
.
MODIFICATION
;
}
/**
* Represents a L2 src/dst modification instruction.
*/
public
static
final
class
ModEtherInstruction
extends
L2ModificationInstruction
{
private
final
SubType
subtype
;
private
final
MACAddress
mac
;
public
ModEtherInstruction
(
SubType
subType
,
MACAddress
addr
)
{
this
.
subtype
=
subType
;
this
.
mac
=
addr
;
}
@Override
public
SubType
subtype
()
{
return
this
.
subtype
;
}
public
MACAddress
mac
()
{
return
this
.
mac
;
}
}
/**
* Represents a L2 type modification instruction.
*/
public
static
final
class
ModEtherTypeInstruction
extends
L2ModificationInstruction
{
public
final
short
l2Type
;
public
ModEtherTypeInstruction
(
short
l2Type
)
{
this
.
l2Type
=
l2Type
;
}
@Override
public
SubType
subtype
()
{
return
SubType
.
L2_TYPE
;
}
public
short
l2Type
()
{
return
this
.
l2Type
;
}
}
/**
* Represents a VLAN id modification instruction.
*/
public
static
final
class
ModVlanIdInstruction
extends
L2ModificationInstruction
{
public
final
Short
vlanId
;
public
ModVlanIdInstruction
(
Short
vlanId
)
{
this
.
vlanId
=
vlanId
;
}
@Override
public
SubType
subtype
()
{
return
SubType
.
VLAN_ID
;
}
public
Short
vlanId
()
{
return
this
.
vlanId
;
}
}
}
of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
View file @
55a55d9
...
...
@@ -77,6 +77,11 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver {
this
.
dpid
=
dp
;
}
public
AbstractOpenFlowSwitch
(
Dpid
dpid
,
OFDescStatsReply
desc
)
{
this
.
dpid
=
dpid
;
this
.
desc
=
desc
;
}
//************************
// Channel related
//************************
...
...
of/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java
View file @
55a55d9
...
...
@@ -11,6 +11,7 @@ import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
import
org.onlab.onos.of.controller.driver.OpenFlowSwitchDriverFactory
;
import
org.projectfloodlight.openflow.protocol.OFDescStatsReply
;
import
org.projectfloodlight.openflow.protocol.OFMessage
;
import
org.projectfloodlight.openflow.protocol.OFPortDesc
;
import
org.projectfloodlight.openflow.protocol.OFVersion
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -57,7 +58,7 @@ public final class DriverManager implements OpenFlowSwitchDriverFactory {
log
.
warn
(
"DriverManager could not identify switch desc: {}. "
+
"Assigning AbstractOpenFlowSwich"
,
desc
);
return
new
AbstractOpenFlowSwitch
(
dpid
)
{
return
new
AbstractOpenFlowSwitch
(
dpid
,
desc
)
{
@Override
public
void
write
(
List
<
OFMessage
>
msgs
)
{
...
...
@@ -85,6 +86,15 @@ public final class DriverManager implements OpenFlowSwitchDriverFactory {
public
boolean
isDriverHandshakeComplete
()
{
return
true
;
}
@Override
public
List
<
OFPortDesc
>
getPorts
()
{
if
(
this
.
factory
().
getVersion
()
==
OFVersion
.
OF_10
)
{
return
Collections
.
unmodifiableList
(
features
.
getPorts
());
}
else
{
return
Collections
.
unmodifiableList
(
ports
.
getEntries
());
}
}
};
}
...
...
providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
View file @
55a55d9
...
...
@@ -5,9 +5,9 @@ import static org.slf4j.LoggerFactory.getLogger;
import
java.util.List
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.Instruction
;
import
org.onlab.onos.net.flow.Instruction.Type
;
import
org.onlab.onos.net.flow.Instructions.OutputInstruction
;
import
org.onlab.onos.net.flow.
instructions.
Instruction
;
import
org.onlab.onos.net.flow.
instructions.
Instruction.Type
;
import
org.onlab.onos.net.flow.
instructions.
Instructions.OutputInstruction
;
import
org.onlab.onos.net.packet.DefaultPacketContext
;
import
org.onlab.onos.net.packet.InboundPacket
;
import
org.onlab.onos.net.packet.OutboundPacket
;
...
...
Please
register
or
login
to post a comment