Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
740448f0
Commit
740448f0
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into cleanup
parents
4ae47f50
fd849259
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!19
Mcp client
,
!18
Develop
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
main.go
+23
-2
23 additions, 2 deletions
main.go
nucleus/controller.go
+4
-7
4 additions, 7 deletions
nucleus/controller.go
nucleus/nucleus-core.go
+1
-3
1 addition, 3 deletions
nucleus/nucleus-core.go
nucleus/root.go
+0
-39
0 additions, 39 deletions
nucleus/root.go
with
28 additions
and
51 deletions
main.go
+
23
−
2
View file @
740448f0
package
main
import
(
"code.fbi.h-da.de/cocsn/gosdn/nucleus"
"flag"
"gosdn/nucleus"
)
// Generate the code out of the yang modules
//go:generate go run $GOPATH/src/github.com/openconfig/ygot/generator/generator.go -path=yang -output_file=yang-processor/gosdnyang.go.go -package_name=gosdnyang -generate_fakeroot -fakeroot_name=device -compress_paths=true -shorten_enum_leaf_names -exclude_modules=ietf-interfaces yang/openconfig-interfaces.yang yang/openconfig-if-ip.yang
type
goSDNConfiguration
struct
{
cliServerAddr4
*
string
cliServerPort4
*
int
}
func
main
()
{
// register our supported flags
cliServerAddr4
:=
flag
.
String
(
"cliServerAddr"
,
"127.0.0.1"
,
"The IPv4 Address of the grpcCLI."
)
cliServerPort4
:=
flag
.
Int
(
"cliServerPort"
,
55055
,
"The port number of the grpcCLI"
)
flag
.
Parse
()
var
myConfiguration
=
new
(
goSDNConfiguration
)
myConfiguration
.
cliServerAddr4
=
cliServerAddr4
myConfiguration
.
cliServerPort4
=
cliServerPort4
// hand off to cmd for further processing
nucleus
.
Execute
()
nucleus
.
StartUp
()
nucleus
.
Run
()
// nothing to see here, please move on!
}
This diff is collapsed.
Click to expand it.
nucleus/controller.go
+
4
−
7
View file @
740448f0
package
nucleus
import
(
yangPro
"code.fbi.h-da.de/cocsn/yang-modules/generated/ciena"
"fmt"
"github.com/openconfig/ygot/ygot"
"net"
yangPro
"gosdn/yang-processor"
)
// This is a test function in order to see how to generate JSON encoded openconfig stuff
...
...
@@ -17,14 +17,11 @@ func AssembleJSON() {
for
_
,
iface
:=
range
interfaces
{
fmt
.
Println
(
iface
.
Name
)
i
,
err
:=
d
.
WaveserverInterfaces
.
NewLogicalInterface
(
"en0"
)
i
,
err
:=
d
.
NewInterface
(
iface
.
Name
)
if
err
!=
nil
{
panic
(
err
)
}
i
.
State
=
&
yangPro
.
CienaWaveserverInterfaces_WaveserverInterfaces_LogicalInterface_State
{
AdminState
:
0
,
OperationalState
:
0
,
}
i
.
Mtu
=
ygot
.
Uint16
(
234
)
//i.Mtu = ygot.Uint16(iface.MTU)
}
...
...
@@ -49,4 +46,4 @@ func AssembleJSON() {
panic
(
fmt
.
Sprintf
(
"Cannot unmarshal JSON: %v"
,
err
))
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
nucleus/nucleus-core.go
+
1
−
3
View file @
740448f0
...
...
@@ -6,6 +6,7 @@ import (
"google.golang.org/grpc"
"log"
"net"
pb
"gosdn/cliInterface"
"time"
)
...
...
@@ -65,9 +66,6 @@ func StartUp() {
func
Run
()
{
isRunning
:=
true
// Test ygot
AssembleJSON
()
for
isRunning
{
time
.
Sleep
(
10
*
time
.
Second
)
isRunning
=
false
...
...
This diff is collapsed.
Click to expand it.
nucleus/root.go
deleted
100644 → 0
+
0
−
39
View file @
4ae47f50
package
nucleus
import
(
"fmt"
"github.com/spf13/cobra"
"os"
)
func
init
()
{
rootCmd
.
AddCommand
(
versionCmd
)
}
var
versionCmd
=
&
cobra
.
Command
{
Use
:
"version"
,
Short
:
"Print the version number of goSDN"
,
Long
:
`A version is a version.`
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
fmt
.
Println
(
"Beachead -- unkown HEAD"
)
},
}
var
rootCmd
=
&
cobra
.
Command
{
Use
:
"goSDN"
,
Short
:
"A yet still incomplete attempt to build an network operating system, but...:-)"
,
Long
:
"Incomplete network operating system. Complete documentation is available at XXX"
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
// Do Stuff Here
StartUp
()
Run
()
},
}
func
Execute
()
{
if
err
:=
rootCmd
.
Execute
();
err
!=
nil
{
fmt
.
Println
(
err
)
os
.
Exit
(
1
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment