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
Jonathan Hart
2014-10-16 10:24:41 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bcae7bdf0e8f4452657541ced8b009a42223827e
bcae7bdf
1 parent
93617211
Removed faulty toInt method and renamed toRealInt to toInt.
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
43 deletions
apps/sdnip/src/main/java/org/onlab/onos/sdnip/PeerConnectivity.java
apps/sdnip/src/main/java/org/onlab/onos/sdnip/RouteEntry.java
apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
apps/sdnip/src/main/java/org/onlab/onos/sdnip/bgp/BgpSession.java
core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
providers/openflow/flow/src/main/java/org/onlab/onos/provider/of/flow/impl/FlowModBuilder.java
utils/misc/src/main/java/org/onlab/packet/IpAddress.java
utils/misc/src/main/java/org/onlab/packet/IpPrefix.java
apps/sdnip/src/main/java/org/onlab/onos/sdnip/PeerConnectivity.java
View file @
bcae7bd
...
...
@@ -126,8 +126,8 @@ public class PeerConnectivity {
TrafficSelector
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
matchIPProtocol
(
IPv4
.
PROTOCOL_TCP
)
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchTcpDst
(
BGP_PORT
)
.
build
();
...
...
@@ -147,8 +147,8 @@ public class PeerConnectivity {
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
matchIPProtocol
(
IPv4
.
PROTOCOL_TCP
)
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchTcpSrc
(
BGP_PORT
)
.
build
();
...
...
@@ -165,8 +165,8 @@ public class PeerConnectivity {
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
matchIPProtocol
(
IPv4
.
PROTOCOL_TCP
)
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchTcpDst
(
BGP_PORT
)
.
build
();
...
...
@@ -183,8 +183,8 @@ public class PeerConnectivity {
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
matchIPProtocol
(
IPv4
.
PROTOCOL_TCP
)
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchTcpSrc
(
BGP_PORT
)
.
build
();
...
...
@@ -251,8 +251,8 @@ public class PeerConnectivity {
TrafficSelector
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
matchIPProtocol
(
IPv4
.
PROTOCOL_ICMP
)
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
build
();
TrafficTreatment
treatment
=
DefaultTrafficTreatment
.
builder
()
...
...
@@ -269,8 +269,8 @@ public class PeerConnectivity {
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
matchIPProtocol
(
IPv4
.
PROTOCOL_ICMP
)
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdAddress
.
to
Real
Int
(),
IPV4_BIT_LENGTH
))
.
matchIPSrc
(
IpPrefix
.
valueOf
(
bgpdPeerAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
matchIPDst
(
IpPrefix
.
valueOf
(
bgpdAddress
.
toInt
(),
IPV4_BIT_LENGTH
))
.
build
();
PointToPointIntent
reversedIntent
=
new
PointToPointIntent
(
...
...
apps/sdnip/src/main/java/org/onlab/onos/sdnip/RouteEntry.java
View file @
bcae7bd
...
...
@@ -58,7 +58,7 @@ public class RouteEntry {
}
StringBuilder
result
=
new
StringBuilder
(
ip4Prefix
.
prefixLength
());
long
value
=
ip4Prefix
.
to
Real
Int
();
long
value
=
ip4Prefix
.
toInt
();
for
(
int
i
=
0
;
i
<
ip4Prefix
.
prefixLength
();
i
++)
{
long
mask
=
1
<<
(
IpAddress
.
MAX_INET_MASK
-
1
-
i
);
result
.
append
(((
value
&
mask
)
==
0
)
?
"0"
:
"1"
);
...
...
apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
View file @
bcae7bd
...
...
@@ -94,7 +94,7 @@ public class Router implements RouteListener {
private
volatile
boolean
isElectedLeader
=
false
;
private
volatile
boolean
isActivatedLeader
=
false
;
// For routes announced by local BGP d
ea
mon in SDN network,
// For routes announced by local BGP d
ae
mon in SDN network,
// the next hop will be 0.0.0.0.
public
static
final
IpAddress
LOCAL_NEXT_HOP
=
IpAddress
.
valueOf
(
"0.0.0.0"
);
...
...
apps/sdnip/src/main/java/org/onlab/onos/sdnip/bgp/BgpSession.java
View file @
bcae7bd
...
...
@@ -1226,7 +1226,7 @@ public class BgpSession extends SimpleChannelHandler {
}
address
<<=
extraShift
;
IpPrefix
prefix
=
IpPrefix
.
valueOf
(
IpAddress
.
valueOf
((
int
)
address
).
to
Real
Int
(),
IpPrefix
.
valueOf
(
IpAddress
.
valueOf
((
int
)
address
).
toInt
(),
(
short
)
prefixBitlen
);
result
.
add
(
prefix
);
}
...
...
@@ -1600,7 +1600,7 @@ public class BgpSession extends SimpleChannelHandler {
message
.
writeByte
(
localBgpVersion
);
message
.
writeShort
((
int
)
localAs
);
message
.
writeShort
((
int
)
localHoldtime
);
message
.
writeInt
(
bgpSessionManager
.
getMyBgpId
().
to
Real
Int
());
message
.
writeInt
(
bgpSessionManager
.
getMyBgpId
().
toInt
());
message
.
writeByte
(
0
);
// No Optional Parameters
return
prepareBgpMessage
(
BgpConstants
.
BGP_TYPE_OPEN
,
message
);
}
...
...
core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
View file @
bcae7bd
...
...
@@ -355,7 +355,7 @@ public class ProxyArpManager implements ProxyArpService {
arp
.
setTargetProtocolAddress
(((
ARP
)
request
.
getPayload
())
.
getSenderProtocolAddress
());
arp
.
setSenderProtocolAddress
(
srcIp
.
to
Real
Int
());
arp
.
setSenderProtocolAddress
(
srcIp
.
toInt
());
eth
.
setPayload
(
arp
);
return
eth
;
}
...
...
providers/openflow/flow/src/main/java/org/onlab/onos/provider/of/flow/impl/FlowModBuilder.java
View file @
bcae7bd
...
...
@@ -161,10 +161,10 @@ public class FlowModBuilder {
switch
(
l3m
.
subtype
())
{
case
IP_DST:
ip
=
(
ModIPInstruction
)
i
;
return
factory
.
actions
().
setNwDst
(
IPv4Address
.
of
(
ip
.
ip
().
to
Real
Int
()));
return
factory
.
actions
().
setNwDst
(
IPv4Address
.
of
(
ip
.
ip
().
toInt
()));
case
IP_SRC:
ip
=
(
ModIPInstruction
)
i
;
return
factory
.
actions
().
setNwSrc
(
IPv4Address
.
of
(
ip
.
ip
().
to
Real
Int
()));
return
factory
.
actions
().
setNwSrc
(
IPv4Address
.
of
(
ip
.
ip
().
toInt
()));
default
:
log
.
warn
(
"Unimplemented action type {}."
,
l3m
.
subtype
());
break
;
...
...
@@ -220,21 +220,21 @@ public class FlowModBuilder {
case
IPV4_DST:
ip
=
(
IPCriterion
)
c
;
if
(
ip
.
ip
().
isMasked
())
{
Masked
<
IPv4Address
>
maskedIp
=
Masked
.
of
(
IPv4Address
.
of
(
ip
.
ip
().
to
Real
Int
()),
IPv4Address
.
of
(
ip
.
ip
().
netmask
().
to
Real
Int
()));
Masked
<
IPv4Address
>
maskedIp
=
Masked
.
of
(
IPv4Address
.
of
(
ip
.
ip
().
toInt
()),
IPv4Address
.
of
(
ip
.
ip
().
netmask
().
toInt
()));
mBuilder
.
setMasked
(
MatchField
.
IPV4_DST
,
maskedIp
);
}
else
{
mBuilder
.
setExact
(
MatchField
.
IPV4_DST
,
IPv4Address
.
of
(
ip
.
ip
().
to
Real
Int
()));
mBuilder
.
setExact
(
MatchField
.
IPV4_DST
,
IPv4Address
.
of
(
ip
.
ip
().
toInt
()));
}
break
;
case
IPV4_SRC:
ip
=
(
IPCriterion
)
c
;
if
(
ip
.
ip
().
isMasked
())
{
Masked
<
IPv4Address
>
maskedIp
=
Masked
.
of
(
IPv4Address
.
of
(
ip
.
ip
().
to
Real
Int
()),
IPv4Address
.
of
(
ip
.
ip
().
netmask
().
to
Real
Int
()));
Masked
<
IPv4Address
>
maskedIp
=
Masked
.
of
(
IPv4Address
.
of
(
ip
.
ip
().
toInt
()),
IPv4Address
.
of
(
ip
.
ip
().
netmask
().
toInt
()));
mBuilder
.
setMasked
(
MatchField
.
IPV4_SRC
,
maskedIp
);
}
else
{
mBuilder
.
setExact
(
MatchField
.
IPV4_SRC
,
IPv4Address
.
of
(
ip
.
ip
().
to
Real
Int
()));
mBuilder
.
setExact
(
MatchField
.
IPV4_SRC
,
IPv4Address
.
of
(
ip
.
ip
().
toInt
()));
}
break
;
case
IP_PROTO:
...
...
utils/misc/src/main/java/org/onlab/packet/IpAddress.java
View file @
bcae7bd
...
...
@@ -176,14 +176,6 @@ public final class IpAddress implements Comparable<IpAddress> {
* @return the IP address's value as an integer
*/
public
int
toInt
()
{
int
address
=
0
;
for
(
int
i
=
0
;
i
<
INET_LEN
;
i
++)
{
address
|=
octets
[
i
]
<<
((
INET_LEN
-
(
i
+
1
))
*
8
);
}
return
address
;
}
public
int
toRealInt
()
{
int
val
=
0
;
for
(
int
i
=
0
;
i
<
octets
.
length
;
i
++)
{
val
<<=
8
;
...
...
@@ -292,8 +284,8 @@ public final class IpAddress implements Comparable<IpAddress> {
@Override
public
int
compareTo
(
IpAddress
o
)
{
Long
lv
=
((
long
)
this
.
to
Real
Int
())
&
0xffffffff
L
;
Long
rv
=
((
long
)
o
.
to
Real
Int
())
&
0xffffffff
L
;
Long
lv
=
((
long
)
this
.
toInt
())
&
0xffffffff
L
;
Long
rv
=
((
long
)
o
.
toInt
())
&
0xffffffff
L
;
return
lv
.
compareTo
(
rv
);
}
...
...
utils/misc/src/main/java/org/onlab/packet/IpPrefix.java
View file @
bcae7bd
...
...
@@ -173,14 +173,6 @@ public final class IpPrefix {
* @return the IP address's value as an integer
*/
public
int
toInt
()
{
int
address
=
0
;
for
(
int
i
=
0
;
i
<
INET_LEN
;
i
++)
{
address
|=
octets
[
i
]
<<
((
INET_LEN
-
(
i
+
1
))
*
8
);
}
return
address
;
}
public
int
toRealInt
()
{
int
val
=
0
;
for
(
int
i
=
0
;
i
<
octets
.
length
;
i
++)
{
val
<<=
8
;
...
...
Please
register
or
login
to post a comment