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
Praseed Balakrishnan
2014-10-15 16:34:59 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
610c1e11d91e6c94673f62c8d7600bc7b82a237c
610c1e11
1 parent
a6235a5a
LINC-OE handshake fix.
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
209 additions
and
43 deletions
openflow/ctl/src/main/java/org/onlab/onos/openflow/drivers/impl/OFOpticalSwitchImplLINC13.java
openflow/ctl/src/main/java/org/onlab/onos/openflow/drivers/impl/OFOpticalSwitchImplLINC13.java
View file @
610c1e1
...
...
@@ -5,6 +5,7 @@ import org.onlab.onos.openflow.controller.driver.SwitchDriverSubHandshakeComplet
import
org.onlab.onos.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted
;
import
org.onlab.onos.openflow.controller.Dpid
;
import
org.onlab.onos.openflow.controller.driver.AbstractOpenFlowSwitch
;
import
org.projectfloodlight.openflow.protocol.OFBarrierRequest
;
import
org.projectfloodlight.openflow.protocol.OFCircuitPortsReply
;
import
org.projectfloodlight.openflow.protocol.OFCircuitPortsRequest
;
import
org.projectfloodlight.openflow.protocol.OFDescStatsReply
;
...
...
@@ -21,7 +22,6 @@ import org.projectfloodlight.openflow.protocol.oxm.OFOxmInPort;
import
org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigid
;
import
org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigidBasic
;
import
org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigtype
;
import
org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigtypeBasic
;
import
org.projectfloodlight.openflow.types.CircuitSignalID
;
import
org.projectfloodlight.openflow.types.OFPort
;
import
org.projectfloodlight.openflow.types.U8
;
...
...
@@ -119,11 +119,12 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
processHandshakeOFExperimenterPortDescRequest
(
(
OFCircuitPortsReply
)
m
);
driverHandshakeComplete
.
set
(
true
);
/*
try {
try
{
testMA
();
testReverseMA
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
*/
}
break
;
default
:
log
.
debug
(
"Received message {} during switch-driver "
+
...
...
@@ -163,22 +164,71 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
"message "
+
"{}"
,
circuitPortsRequest
.
toString
());
channel
.
write
(
Collections
.
singletonList
(
circuitPortsRequest
));
sendMsg
(
Collections
.<
OFMessage
>
singletonList
(
circuitPortsRequest
));
}
//todo for testing
public
static
final
U8
SIGNAL_TYPE
=
U8
.
of
((
short
)
1
);
public
static
final
U8
SIGNAL_TYPE
=
U8
.
of
((
short
)
10
);
private
void
testMA
()
throws
IOException
{
log
.
debug
(
"LINC OE *** Testing MA "
);
short
lambda
=
1
00
;
if
(
getId
()
==
0x0000ffffffffff0
2
L
)
{
short
lambda
=
1
;
if
(
getId
()
==
0x0000ffffffffff0
1
L
)
{
final
int
inport
=
10
;
final
int
outport
=
20
;
//Circuit signal id
CircuitSignalID
sigID
=
getSignalID
(
lambda
);
OFOxmOchSigidBasic
ofOxmOchSigidBasic
=
factory
().
oxms
().
ochSigidBasic
(
sigID
);
//Match Port
OFOxmInPort
fieldPort
=
factory
().
oxms
()
.
inPort
(
OFPort
.
of
(
inport
));
OFMatchV3
matchPort
=
factory
()
.
buildMatchV3
().
setOxmList
(
OFOxmList
.
of
(
fieldPort
)).
build
();
// Set Action outport ,sigType and sigID
List
<
OFAction
>
actionList
=
new
ArrayList
<>();
OFAction
actionOutPort
=
factory
().
actions
().
output
(
OFPort
.
of
(
outport
),
0xffff
);
OFActionCircuit
actionCircuit
=
factory
()
.
actions
()
.
circuit
(
ofOxmOchSigidBasic
);
actionList
.
add
(
actionCircuit
);
actionList
.
add
(
actionOutPort
);
OFInstruction
instructionAction
=
factory
().
instructions
().
buildApplyActions
()
.
setActions
(
actionList
)
.
build
();
List
<
OFInstruction
>
instructions
=
Collections
.
singletonList
(
instructionAction
);
OFMessage
opticalFlowEntry
=
factory
().
buildFlowAdd
()
.
setMatch
(
matchPort
)
.
setPriority
(
100
)
.
setInstructions
(
instructions
)
.
setXid
(
getNextTransactionId
())
.
build
();
log
.
debug
(
"Adding optical flow in sw {}"
,
getStringId
());
List
<
OFMessage
>
msglist
=
new
ArrayList
<>(
1
);
msglist
.
add
(
opticalFlowEntry
);
write
(
msglist
);
sendBarrier
(
true
);
}
else
if
(
getId
()
==
0x0000ffffffffff03
L
)
{
final
int
inport
=
30
;
final
int
outport
=
31
;
//Circuit signal id
CircuitSignalID
sigID
=
getSignalID
(
lambda
);
OFOxmOchSigid
fieldSigIDMatch
=
factory
().
oxms
().
ochSigid
(
sigID
);
OFOxmOchSigtype
fieldSigType
=
factory
()
.
oxms
()
...
...
@@ -187,8 +237,119 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFOxmOchSigidBasic
ofOxmOchSigidBasic
=
factory
().
oxms
().
ochSigidBasic
(
sigID
);
OFOxmOchSigtypeBasic
ofOxmOchSigtypeBasic
=
factory
().
oxms
().
ochSigtypeBasic
(
SIGNAL_TYPE
);
//Match Port,SigType,SigID
OFOxmInPort
fieldPort
=
factory
()
.
oxms
()
.
inPort
(
OFPort
.
of
(
inport
));
OFMatchV3
matchPort
=
factory
()
.
buildMatchV3
()
.
setOxmList
(
OFOxmList
.
of
(
fieldPort
,
fieldSigIDMatch
,
fieldSigType
))
.
build
();
// Set Action outport ,SigType, sigID
List
<
OFAction
>
actionList
=
new
ArrayList
<>();
OFAction
actionOutPort
=
factory
().
actions
().
output
(
OFPort
.
of
(
outport
),
0xffff
);
OFActionCircuit
actionCircuit
=
factory
()
.
actions
()
.
circuit
(
ofOxmOchSigidBasic
);
//actionList.add(setActionSigType);
actionList
.
add
(
actionCircuit
);
actionList
.
add
(
actionOutPort
);
OFInstruction
instructionAction
=
factory
().
instructions
().
buildApplyActions
()
.
setActions
(
actionList
)
.
build
();
List
<
OFInstruction
>
instructions
=
Collections
.
singletonList
(
instructionAction
);
OFMessage
opticalFlowEntry
=
factory
().
buildFlowAdd
()
.
setMatch
(
matchPort
)
.
setPriority
(
100
)
.
setInstructions
(
instructions
)
.
setXid
(
getNextTransactionId
())
.
build
();
log
.
debug
(
"Adding optical flow in sw {}"
,
getStringId
());
List
<
OFMessage
>
msglist
=
new
ArrayList
<>(
1
);
msglist
.
add
(
opticalFlowEntry
);
write
(
msglist
);
sendBarrier
(
true
);
}
else
if
(
getId
()
==
0x0000ffffffffff02
L
)
{
final
int
inport
=
21
;
final
int
outport
=
11
;
//Circuit signal id
CircuitSignalID
sigID
=
getSignalID
(
lambda
);
OFOxmOchSigid
fieldSigIDMatch
=
factory
().
oxms
().
ochSigid
(
sigID
);
OFOxmOchSigtype
fieldSigType
=
factory
()
.
oxms
()
.
ochSigtype
(
SIGNAL_TYPE
);
//Match Port, sig type and sig id
OFOxmInPort
fieldPort
=
factory
()
.
oxms
()
.
inPort
(
OFPort
.
of
(
inport
));
OFMatchV3
matchPort
=
factory
().
buildMatchV3
()
.
setOxmList
(
OFOxmList
.
of
(
fieldPort
,
fieldSigIDMatch
,
fieldSigType
))
.
build
();
// Set Action outport
List
<
OFAction
>
actionList
=
new
ArrayList
<>();
OFAction
actionOutPort
=
factory
().
actions
().
output
(
OFPort
.
of
(
outport
),
0xffff
);
actionList
.
add
(
actionOutPort
);
OFInstruction
instructionAction
=
factory
().
instructions
().
buildApplyActions
()
.
setActions
(
actionList
)
.
build
();
List
<
OFInstruction
>
instructions
=
Collections
.
singletonList
(
instructionAction
);
OFMessage
opticalFlowEntry
=
factory
().
buildFlowAdd
()
.
setMatch
(
matchPort
)
.
setPriority
(
100
)
.
setInstructions
(
instructions
)
.
setXid
(
getNextTransactionId
())
.
build
();
log
.
debug
(
"Adding optical flow in sw {}"
,
getStringId
());
List
<
OFMessage
>
msglist
=
new
ArrayList
<>(
1
);
msglist
.
add
(
opticalFlowEntry
);
write
(
msglist
);
sendBarrier
(
true
);
}
}
private
void
testReverseMA
()
throws
IOException
{
log
.
debug
(
"LINC OE *** Testing MA "
);
short
lambda
=
1
;
if
(
getId
()
==
0x0000ffffffffff02
L
)
{
final
int
inport
=
11
;
final
int
outport
=
21
;
//Circuit signal id
CircuitSignalID
sigID
=
getSignalID
(
lambda
);
OFOxmOchSigidBasic
ofOxmOchSigidBasic
=
factory
().
oxms
().
ochSigidBasic
(
sigID
);
//Match Port
OFOxmInPort
fieldPort
=
factory
().
oxms
()
...
...
@@ -196,27 +357,20 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFMatchV3
matchPort
=
factory
()
.
buildMatchV3
().
setOxmList
(
OFOxmList
.
of
(
fieldPort
,
fieldSigType
,
fieldSigIDMatch
)).
build
();
setOxmList
(
OFOxmList
.
of
(
fieldPort
)).
build
();
// Set Action outport ,sigType and sigID
List
<
OFAction
>
actionList
=
new
ArrayList
<>();
OFAction
actionOutPort
=
factory
().
actions
().
output
(
OFPort
.
of
(
outport
),
Short
.
MAX_VALUE
);
0xffff
);
OFActionCircuit
actionCircuit
=
factory
()
.
actions
()
.
circuit
(
ofOxmOchSigidBasic
);
OFActionCircuit
setActionSigType
=
factory
()
.
actions
()
.
circuit
(
ofOxmOchSigtypeBasic
);
actionList
.
add
(
actionOutPort
);
actionList
.
add
(
setActionSigType
);
actionList
.
add
(
actionCircuit
);
actionList
.
add
(
actionOutPort
);
OFInstruction
instructionAction
=
factory
().
instructions
().
buildApplyActions
()
...
...
@@ -228,6 +382,7 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFMessage
opticalFlowEntry
=
factory
().
buildFlowAdd
()
.
setMatch
(
matchPort
)
.
setPriority
(
100
)
.
setInstructions
(
instructions
)
.
setXid
(
getNextTransactionId
())
.
build
();
...
...
@@ -235,9 +390,10 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
List
<
OFMessage
>
msglist
=
new
ArrayList
<>(
1
);
msglist
.
add
(
opticalFlowEntry
);
write
(
msglist
);
sendBarrier
(
true
);
}
else
if
(
getId
()
==
0x0000ffffffffff03
L
)
{
final
int
inport
=
2
1
;
final
int
outport
=
22
;
final
int
inport
=
3
1
;
final
int
outport
=
30
;
//Circuit signal id
CircuitSignalID
sigID
=
getSignalID
(
lambda
);
...
...
@@ -249,9 +405,6 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFOxmOchSigidBasic
ofOxmOchSigidBasic
=
factory
().
oxms
().
ochSigidBasic
(
sigID
);
OFOxmOchSigtypeBasic
ofOxmOchSigtypeBasic
=
factory
().
oxms
().
ochSigtypeBasic
(
SIGNAL_TYPE
);
//Match Port,SigType,SigID
OFOxmInPort
fieldPort
=
factory
()
.
oxms
()
...
...
@@ -259,27 +412,22 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFMatchV3
matchPort
=
factory
()
.
buildMatchV3
()
.
setOxmList
(
OFOxmList
.
of
(
fieldPort
,
fieldSigType
,
fieldSigIDMatch
))
fieldSigIDMatch
,
fieldSigType
))
.
build
();
// Set Action outport ,SigType, sigID
List
<
OFAction
>
actionList
=
new
ArrayList
<>();
OFAction
actionOutPort
=
factory
().
actions
().
output
(
OFPort
.
of
(
outport
),
Short
.
MAX_VALUE
);
OFActionCircuit
setActionSigType
=
factory
()
.
actions
()
.
circuit
(
ofOxmOchSigtypeBasic
);
0xffff
);
OFActionCircuit
actionCircuit
=
factory
()
.
actions
()
.
circuit
(
ofOxmOchSigidBasic
);
actionList
.
add
(
actionOutPort
);
actionList
.
add
(
setActionSigType
);
actionList
.
add
(
actionCircuit
);
actionList
.
add
(
actionOutPort
);
OFInstruction
instructionAction
=
factory
().
instructions
().
buildApplyActions
()
...
...
@@ -291,6 +439,7 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFMessage
opticalFlowEntry
=
factory
().
buildFlowAdd
()
.
setMatch
(
matchPort
)
.
setPriority
(
100
)
.
setInstructions
(
instructions
)
.
setXid
(
getNextTransactionId
())
.
build
();
...
...
@@ -298,10 +447,11 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
List
<
OFMessage
>
msglist
=
new
ArrayList
<>(
1
);
msglist
.
add
(
opticalFlowEntry
);
write
(
msglist
);
sendBarrier
(
true
);
}
else
if
(
getId
()
==
0x0000ffffffffff0
4
L
)
{
final
int
inport
=
2
3
;
final
int
outport
=
1
1
;
}
else
if
(
getId
()
==
0x0000ffffffffff0
1
L
)
{
final
int
inport
=
2
0
;
final
int
outport
=
1
0
;
//Circuit signal id
CircuitSignalID
sigID
=
getSignalID
(
lambda
);
...
...
@@ -318,15 +468,16 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFMatchV3
matchPort
=
factory
().
buildMatchV3
()
.
setOxmList
(
OFOxmList
.
of
(
fieldPort
,
fieldSigType
,
fieldSigIDMatch
))
fieldSigIDMatch
,
fieldSigType
))
.
build
();
// Set Action outport
List
<
OFAction
>
actionList
=
new
ArrayList
<>();
OFAction
actionOutPort
=
factory
().
actions
().
output
(
OFPort
.
of
(
outport
),
Short
.
MAX_VALUE
);
0xffff
);
actionList
.
add
(
actionOutPort
);
...
...
@@ -340,6 +491,7 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
OFMessage
opticalFlowEntry
=
factory
().
buildFlowAdd
()
.
setMatch
(
matchPort
)
.
setPriority
(
100
)
.
setInstructions
(
instructions
)
.
setXid
(
getNextTransactionId
())
.
build
();
...
...
@@ -347,10 +499,12 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
List
<
OFMessage
>
msglist
=
new
ArrayList
<>(
1
);
msglist
.
add
(
opticalFlowEntry
);
write
(
msglist
);
sendBarrier
(
true
);
}
}
// Todo remove - for testing purpose only
private
static
CircuitSignalID
getSignalID
(
short
lambda
)
{
byte
myGrid
=
1
;
...
...
@@ -365,9 +519,21 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch {
return
signalID
;
}
private
void
sendBarrier
(
boolean
finalBarrier
)
throws
IOException
{
int
xid
=
getNextTransactionId
();
if
(
finalBarrier
)
{
barrierXidToWaitFor
=
xid
;
}
OFBarrierRequest
br
=
factory
()
.
buildBarrierRequest
()
.
setXid
(
xid
)
.
build
();
sendMsg
(
br
);
}
@Override
public
void
write
(
OFMessage
msg
)
{
this
.
channel
.
write
(
msg
);
this
.
sendMsg
(
msg
);
}
@Override
...
...
Please
register
or
login
to post a comment