Added cni config path and binary path
authorMichael Cambria <mcambria@redhat.com>
Tue, 16 Apr 2019 21:49:52 +0000 (17:49 -0400)
committerMichael Cambria <mcambria@redhat.com>
Tue, 16 Apr 2019 21:49:52 +0000 (17:49 -0400)
api/api.proto
api/handler.go
client/main.go
server/main.go

index 11dc5af..f925f2a 100644 (file)
@@ -25,13 +25,20 @@ message CNIargs {
   string value = 2;
 }
 
+message ConfPath {
+  string netDir = 1;
+  string netConf = 2;
+}
+
 message CNImsg {
-  CmdType cmd = 1;
-  string containerID = 2;
-  string netNS = 3;
-  string ifName = 4;
-  repeated CNIargs args = 5;
-  string stdIn = 6;
+  ConfPath configPath = 1;
+  string binPath = 8;
+  CmdType cmd = 2;
+  string containerID = 3;
+  string netNS = 4;
+  string ifName = 5;
+  repeated CNIargs args = 6;
+  string stdIn = 7;
 }
 
 message CNIresult {
index 07023cb..0a62665 100644 (file)
@@ -12,7 +12,12 @@ type CNIServer struct {
 
 // CNIop generates result to a CNImsg
 func (s *CNIServer) CNIop(ctx context.Context, in *CNImsg) (*CNIresult, error) {
-       log.Printf("Receive message Cmd: %s", in.Cmd)
+
+       confPath := in.ConfigPath
+
+       log.Printf("Receive message NetDir: %s", confPath.NetDir)
+       log.Printf("Receive message NetConf: %s", confPath.NetConf)
+
        log.Printf("Receive message ContainerID: %s", in.ContainerID)
        log.Printf("Receive message NetNS: %s", in.NetNS)
        log.Printf("Receive message IfName: %s", in.IfName)
index a2fc3db..522d167 100644 (file)
@@ -53,7 +53,19 @@ func main() {
        // CNI Test 
        cni := api.NewCNIserverClient(conn)
 
+       ///
+       cniPath := api.ConfPath {
+                NetDir: "/home/mcambria/go/src/github.com/containernetworking",
+                NetConf: "firewall-mcc1-range-chain",
+              }
+       //
+
        cniMsg := api.CNImsg{
+              //ConfigPath: {
+              //NetDir: "/home/mcambria/go/src/github.com/containernetworking",
+              //NetConf: "firewall-mcc1-range-chain",
+              //},
+              ConfigPath: &cniPath,
               Cmd: api.CmdType_ADD,
               ContainerID: "containerOne",
               NetNS: "mcc-test-0",
index 658e889..ffdb8ad 100644 (file)
@@ -117,8 +117,7 @@ func startRESTServer(address, grpcAddress, certFile string) error {
        // Setup the client gRPC options
        opts := []grpc.DialOption{grpc.WithTransportCredentials(creds)}
 
-       // Register ping
-       //err = api.RegisterPingHandlerFromEndpoint(ctx, mux, grpcAddress, opts)
+       // Register CNIserver 
        err = api.RegisterCNIserverHandlerFromEndpoint(ctx, mux, grpcAddress, opts)
        if err != nil {
                return fmt.Errorf("could not register service CNI: %s", err)