Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gn4
tutorial
Commits
9941bda5
Commit
9941bda5
authored
Jul 01, 2015
by
Michele Santuari
Browse files
Point Intent installation
parent
38a7af64
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/geant/AppComponent.java
View file @
9941bda5
...
...
@@ -15,10 +15,26 @@
*/
package
org.geant
;
import
java.net.URI
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Deactivate
;
import
org.apache.felix.scr.annotations.Reference
;
import
org.apache.felix.scr.annotations.ReferenceCardinality
;
import
org.apache.felix.scr.annotations.Service
;
import
org.onlab.packet.MacAddress
;
import
org.onosproject.cfg.ComponentConfigService
;
import
org.onosproject.core.ApplicationId
;
import
org.onosproject.core.CoreService
;
import
org.onosproject.net.ConnectPoint
;
import
org.onosproject.net.DeviceId
;
import
org.onosproject.net.ElementId
;
import
org.onosproject.net.PortNumber
;
import
org.onosproject.net.flow.DefaultTrafficSelector
;
import
org.onosproject.net.flow.TrafficSelector
;
import
org.onosproject.net.intent.IntentService
;
import
org.onosproject.net.intent.PointToPointIntent
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -30,9 +46,49 @@ public class AppComponent {
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
getClass
());
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
IntentService
intentService
;
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
CoreService
coreService
;
private
ApplicationId
appId
;
@Activate
protected
void
activate
()
{
log
.
info
(
"Started"
);
appId
=
coreService
.
registerApplication
(
"org.onosproject.tutorial"
);
TrafficSelector
selecAlice
=
DefaultTrafficSelector
.
builder
()
.
matchEthSrc
(
MacAddress
.
valueOf
(
1
)).
build
();
TrafficSelector
selecBob
=
DefaultTrafficSelector
.
builder
()
.
matchEthSrc
(
MacAddress
.
valueOf
(
2
)).
build
();
PointToPointIntent
ptpIntentFromAlice
=
PointToPointIntent
.
builder
()
.
appId
(
appId
)
.
ingressPoint
(
new
ConnectPoint
(
DeviceId
.
deviceId
(
"of:000000000000000B"
),
PortNumber
.
portNumber
(
1
)))
.
egressPoint
(
new
ConnectPoint
(
DeviceId
.
deviceId
(
"of:0000000000000016"
),
PortNumber
.
portNumber
(
1
))).
selector
(
selecAlice
)
.
build
();
PointToPointIntent
ptpIntentFromBob
=
PointToPointIntent
.
builder
()
.
appId
(
appId
)
.
ingressPoint
(
new
ConnectPoint
(
DeviceId
.
deviceId
(
"of:0000000000000016"
),
PortNumber
.
portNumber
(
1
)))
.
egressPoint
(
new
ConnectPoint
(
DeviceId
.
deviceId
(
"of:000000000000000B"
),
PortNumber
.
portNumber
(
1
))).
selector
(
selecBob
)
.
build
();
intentService
.
submit
(
ptpIntentFromAlice
);
intentService
.
submit
(
ptpIntentFromBob
);
}
@Deactivate
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment