add generate nlsr.conf bash script

This commit is contained in:
SunnyQjm committed 2018-12-06 20:18:49 +08:00
1 parent e020272439
commit cea263a7c1
7 files changed
+247 -21

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
cat << EOF
; the advertising section contains the configuration settings of the name prefixes
; hosted by this router
advertising
{
; the ndnname is used to advertised name from the router. To advertise each name prefix
; configure one block of ndnname configuration command for every name prefix.
;prefix /ndn/edu/test1 ; name in ndn URI format
;prefix /ndn/edu/test2
}
EOF
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
cat << EOF
; the fib section is used to configure fib entrys type to ndn FIB updated by NLSR
fib
{
; the max-faces-per-prefix is used to limit the number of faces for each name prefixes
; by NLSR in ndn FIB
max-faces-per-prefix 3 ; default value 0. Valid value 0-60. By default (value 0) NLSR adds
; all available faces for each reachable name prefixes in NDN FIB
; routing-calc-interval is the time to wait in seconds after a routing table calculation is
; scheduled before actually performing the routing table calculation
routing-calc-interval 15 ; default value 15. Valid values 0-15. It is recommended that
; routing-calc-interval have a higher value than adj-lsa-build-interval
}
EOF
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
cat << EOF
; the hyperbolic section contains the configuration settings of enabling a router to calculate
; routing table using [hyperbolic routing table calculation](http://arxiv.org/abs/0805.1266) method
hyperbolic
{
; commands in this section follows a strict order
; the switch is used to set hyperbolic routing calculation in NLSR
state off ; default value 'off', set value 'on' to enable hyperbolic routing table
; calculation which turns link state routing 'off'. set value to 'dry-run'
; to test hyperbolic routing and compare with link state routing.
radius 123.456 ; radius of the router in hyperbolic coordinate system
angle 1.45,2.36 ; angle of the router in hyperbolic coordinate system
}
EOF
@@ -1,7 +1,8 @@
#!/bin/bash
TEMP_DIR=../temp
name=$1
transName=$(echo ${routerName//\//.})
TEMP_DIR=../temp
transName=$(echo ${name//\//.})
transName=$(echo ${transName#.})
nbs=$(cat $TEMP_DIR/$transName.nbs)
cat << EOF
@@ -49,24 +50,18 @@ let 'length = length - 1'
for index in `seq 0 $length`
do
neighbourName=$(echo $nbs | jq -r ".[$index].name")
faceUri=ether://[$(echo $nbs | jq -r ".[$index].targetMac")]
linkCost=25
cat << EOF
neighbor
{
name $neighbourName ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri $faceUri ; face uri of the face connected to the neighbor
link-cosr $linkCost ; cost of the connecting link to neighbor
}
EOF
done
needighbor
{
name /ndn/edu/%C1.Router/pkun2 ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri ether://[a0:36:9f:85:c4:9f] ; face uri of the face connected to the neighbor
link-cost 25 ; cost of the connecting link to neighbor
}
neighbor
{
name /ndn/edu/%C1.Router/pkun3 ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri ether://[a0:36:9f:85:c9:de] ; face uri of the face connected to the neighbor
link-cost 25 ; cost of the connecting link to neighbor
}
}
echo }
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
cat << EOF
security
{
validator
{
trust-anchor
{
type any
}
}
prefix-update-validator
{
trust-anchor
{
type any
}
}
}
EOF
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
name=$1
network=$2
site=$3
router=$4
cat /dev/null > nlsr.conf
./generate-general.sh $network $site $router >> nlsr.conf
./generate-neighbour.sh $name >> nlsr.conf
./generate-hyperbolic.sh >> nlsr.conf
./generate-fib.sh >> nlsr.conf
./generate-security.sh >> nlsr.conf
+140
View File
@@ -0,0 +1,140 @@
; the general section contains all the general settings for router
general
{
; mandatory configuration command section network, site and router
network /ndn ; name of the network the router belongs to in ndn URI format
site /edu/pkusz ; name of the site the router belongs to in ndn URI format
router /pkun1 ; name of the router in ndn URI format
; lsa-refresh-time is the time in seconds, after which router will refresh its LSAs
lsa-refresh-time 1800 ; default value 1800. Valid values 240-7200
; router-dead-interval is the time in seconds after which an inactive routers
; LSAs are removed
;router-dead-interval 3600 ; default value: 2*lsa-refresh-time. Value must be larger
; than lsa-refresh-time
; InterestLifetime (in seconds) for LSA fetching
lsa-interest-lifetime 4 ; default value 4. Valid values 1-60
; sync interest lifetime of ChronoSync in milliseconds
sync-interest-lifetime 60000 ; default value 60000. Valid values 1000-120,000
seq-dir /var/lib/nlsr ; path for sequence directory (Absolute path)
}
neighbors
{
; in case hello interest timed out, router will try 'hello-retries' times at 'hello-timeout'
; seconds interval before giving up for any neighbors (deciding link is down)
hello-retries 3 ; interest retries number in integer. Default value 3
; valid values 1-10
hello-timeout 1 ; interest time out value in integer. Default value 1
; Valid values 1-15
hello-interval 60 ; interest sending interval in seconds. Default value 60
; valid values 30-90
; adj-lsa-build-interval is the time to wait in seconds after an Adjacency LSA build is scheduled
; before actually building the Adjacency LSA
adj-lsa-build-interval 5 ; default value 5. Valid values 0-5. It is recommended that
; adj-lsa-build-interval have a lower value than routing-calc-interval
; first-hello-interval is the time to wait in seconds before sending the first Hello Interest
first-hello-interval 10 ; Default value 10. Valid values 0-10
face-dataset-fetch-tries 3 ; default is 3. Valid values 1-10. The FaceDataset is
; gotten from NFD, and is needed to configure NLSR
; correctly. It is recommended not to set this
; variable too high, because it could cause
; congestion for NFD.
face-dataset-fetch-interval 3600 ; default is 3600. Valid values 1800-5400.
; This controls how often (in seconds) NLSR will attempt to
; fetch a FaceStatus dataset from NFD.
; neighbor command is used to configure router's neighbor. Each neighbor will need
; one block of neighbor command
neighbor
{
name /ndn/edu/pkusz/pkun3 ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri ether://[a0:36:9f:85:c9:dc] ; face uri of the face connected to the neighbor
link-cosr 25 ; cost of the connecting link to neighbor
}
neighbor
{
name /ndn/edu/pkusz/pkun2 ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri ether://[a0:36:9f:85:c4:9f] ; face uri of the face connected to the neighbor
link-cosr 25 ; cost of the connecting link to neighbor
}
neighbor
{
name /ndn/edu/pkusz/main2 ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri ether://[00:1b:21:09:09:10] ; face uri of the face connected to the neighbor
link-cosr 25 ; cost of the connecting link to neighbor
}
}
; the hyperbolic section contains the configuration settings of enabling a router to calculate
; routing table using [hyperbolic routing table calculation](http://arxiv.org/abs/0805.1266) method
hyperbolic
{
; commands in this section follows a strict order
; the switch is used to set hyperbolic routing calculation in NLSR
state off ; default value 'off', set value 'on' to enable hyperbolic routing table
; calculation which turns link state routing 'off'. set value to 'dry-run'
; to test hyperbolic routing and compare with link state routing.
radius 123.456 ; radius of the router in hyperbolic coordinate system
angle 1.45,2.36 ; angle of the router in hyperbolic coordinate system
}
; the fib section is used to configure fib entrys type to ndn FIB updated by NLSR
fib
{
; the max-faces-per-prefix is used to limit the number of faces for each name prefixes
; by NLSR in ndn FIB
max-faces-per-prefix 3 ; default value 0. Valid value 0-60. By default (value 0) NLSR adds
; all available faces for each reachable name prefixes in NDN FIB
; routing-calc-interval is the time to wait in seconds after a routing table calculation is
; scheduled before actually performing the routing table calculation
routing-calc-interval 15 ; default value 15. Valid values 0-15. It is recommended that
; routing-calc-interval have a higher value than adj-lsa-build-interval
}
security
{
validator
{
trust-anchor
{
type any
}
}
prefix-update-validator
{
trust-anchor
{
type any
}
}
}