Exposing ONU restart EAPOL/DHCP/IGMP endpoints

Change-Id: Id3a4722117ebc8b070318dc8ffcdb7ed08bc7a24
diff --git a/api/bbsim/bbsim.pb.gw.go b/api/bbsim/bbsim.pb.gw.go
index acf8fe9..1826d3b 100644
--- a/api/bbsim/bbsim.pb.gw.go
+++ b/api/bbsim/bbsim.pb.gw.go
@@ -427,6 +427,114 @@
 
 }
 
+func request_BBSim_RestartEapol_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+	var protoReq ONURequest
+	var metadata runtime.ServerMetadata
+
+	var (
+		val string
+		ok  bool
+		err error
+		_   = err
+	)
+
+	val, ok = pathParams["SerialNumber"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SerialNumber")
+	}
+
+	protoReq.SerialNumber, err = runtime.String(val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SerialNumber", err)
+	}
+
+	msg, err := client.RestartEapol(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+	return msg, metadata, err
+
+}
+
+func local_request_BBSim_RestartEapol_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+	var protoReq ONURequest
+	var metadata runtime.ServerMetadata
+
+	var (
+		val string
+		ok  bool
+		err error
+		_   = err
+	)
+
+	val, ok = pathParams["SerialNumber"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SerialNumber")
+	}
+
+	protoReq.SerialNumber, err = runtime.String(val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SerialNumber", err)
+	}
+
+	msg, err := server.RestartEapol(ctx, &protoReq)
+	return msg, metadata, err
+
+}
+
+func request_BBSim_RestartDhcp_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+	var protoReq ONURequest
+	var metadata runtime.ServerMetadata
+
+	var (
+		val string
+		ok  bool
+		err error
+		_   = err
+	)
+
+	val, ok = pathParams["SerialNumber"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SerialNumber")
+	}
+
+	protoReq.SerialNumber, err = runtime.String(val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SerialNumber", err)
+	}
+
+	msg, err := client.RestartDhcp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+	return msg, metadata, err
+
+}
+
+func local_request_BBSim_RestartDhcp_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+	var protoReq ONURequest
+	var metadata runtime.ServerMetadata
+
+	var (
+		val string
+		ok  bool
+		err error
+		_   = err
+	)
+
+	val, ok = pathParams["SerialNumber"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SerialNumber")
+	}
+
+	protoReq.SerialNumber, err = runtime.String(val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SerialNumber", err)
+	}
+
+	msg, err := server.RestartDhcp(ctx, &protoReq)
+	return msg, metadata, err
+
+}
+
 var (
 	filter_BBSim_SetOnuAlarmIndication_0 = &utilities.DoubleArray{Encoding: map[string]int{"SerialNumber": 0, "AlarmType": 1, "Status": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
 )
@@ -725,6 +833,125 @@
 
 }
 
+var (
+	filter_BBSim_ChangeIgmpState_0 = &utilities.DoubleArray{Encoding: map[string]int{"OnuReq": 0, "SerialNumber": 1, "SubActionVal": 2, "GroupAddress": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 1, 1, 3, 4, 5}}
+)
+
+func request_BBSim_ChangeIgmpState_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+	var protoReq IgmpRequest
+	var metadata runtime.ServerMetadata
+
+	var (
+		val string
+		e   int32
+		ok  bool
+		err error
+		_   = err
+	)
+
+	val, ok = pathParams["OnuReq.SerialNumber"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "OnuReq.SerialNumber")
+	}
+
+	err = runtime.PopulateFieldFromPath(&protoReq, "OnuReq.SerialNumber", val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "OnuReq.SerialNumber", err)
+	}
+
+	val, ok = pathParams["SubActionVal"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SubActionVal")
+	}
+
+	e, err = runtime.Enum(val, SubActionTypes_value)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SubActionVal", err)
+	}
+
+	protoReq.SubActionVal = SubActionTypes(e)
+
+	val, ok = pathParams["GroupAddress"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "GroupAddress")
+	}
+
+	protoReq.GroupAddress, err = runtime.String(val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "GroupAddress", err)
+	}
+
+	if err := req.ParseForm(); err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+	}
+	if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BBSim_ChangeIgmpState_0); err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+	}
+
+	msg, err := client.ChangeIgmpState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+	return msg, metadata, err
+
+}
+
+func local_request_BBSim_ChangeIgmpState_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+	var protoReq IgmpRequest
+	var metadata runtime.ServerMetadata
+
+	var (
+		val string
+		e   int32
+		ok  bool
+		err error
+		_   = err
+	)
+
+	val, ok = pathParams["OnuReq.SerialNumber"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "OnuReq.SerialNumber")
+	}
+
+	err = runtime.PopulateFieldFromPath(&protoReq, "OnuReq.SerialNumber", val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "OnuReq.SerialNumber", err)
+	}
+
+	val, ok = pathParams["SubActionVal"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SubActionVal")
+	}
+
+	e, err = runtime.Enum(val, SubActionTypes_value)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SubActionVal", err)
+	}
+
+	protoReq.SubActionVal = SubActionTypes(e)
+
+	val, ok = pathParams["GroupAddress"]
+	if !ok {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "GroupAddress")
+	}
+
+	protoReq.GroupAddress, err = runtime.String(val)
+
+	if err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "GroupAddress", err)
+	}
+
+	if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSim_ChangeIgmpState_0); err != nil {
+		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+	}
+
+	msg, err := server.ChangeIgmpState(ctx, &protoReq)
+	return msg, metadata, err
+
+}
+
 func request_BBSim_GetOnuTrafficSchedulers_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
 	var protoReq ONURequest
 	var metadata runtime.ServerMetadata
@@ -1024,6 +1251,46 @@
 
 	})
 
+	mux.Handle("POST", pattern_BBSim_RestartEapol_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+		ctx, cancel := context.WithCancel(req.Context())
+		defer cancel()
+		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+		resp, md, err := local_request_BBSim_RestartEapol_0(rctx, inboundMarshaler, server, req, pathParams)
+		ctx = runtime.NewServerMetadataContext(ctx, md)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+
+		forward_BBSim_RestartEapol_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+	})
+
+	mux.Handle("POST", pattern_BBSim_RestartDhcp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+		ctx, cancel := context.WithCancel(req.Context())
+		defer cancel()
+		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+		resp, md, err := local_request_BBSim_RestartDhcp_0(rctx, inboundMarshaler, server, req, pathParams)
+		ctx = runtime.NewServerMetadataContext(ctx, md)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+
+		forward_BBSim_RestartDhcp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+	})
+
 	mux.Handle("POST", pattern_BBSim_SetOnuAlarmIndication_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
 		ctx, cancel := context.WithCancel(req.Context())
 		defer cancel()
@@ -1104,6 +1371,26 @@
 
 	})
 
+	mux.Handle("POST", pattern_BBSim_ChangeIgmpState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+		ctx, cancel := context.WithCancel(req.Context())
+		defer cancel()
+		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+		resp, md, err := local_request_BBSim_ChangeIgmpState_0(rctx, inboundMarshaler, server, req, pathParams)
+		ctx = runtime.NewServerMetadataContext(ctx, md)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+
+		forward_BBSim_ChangeIgmpState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+	})
+
 	mux.Handle("GET", pattern_BBSim_GetOnuTrafficSchedulers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
 		ctx, cancel := context.WithCancel(req.Context())
 		defer cancel()
@@ -1405,6 +1692,46 @@
 
 	})
 
+	mux.Handle("POST", pattern_BBSim_RestartEapol_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+		ctx, cancel := context.WithCancel(req.Context())
+		defer cancel()
+		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+		rctx, err := runtime.AnnotateContext(ctx, mux, req)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+		resp, md, err := request_BBSim_RestartEapol_0(rctx, inboundMarshaler, client, req, pathParams)
+		ctx = runtime.NewServerMetadataContext(ctx, md)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+
+		forward_BBSim_RestartEapol_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+	})
+
+	mux.Handle("POST", pattern_BBSim_RestartDhcp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+		ctx, cancel := context.WithCancel(req.Context())
+		defer cancel()
+		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+		rctx, err := runtime.AnnotateContext(ctx, mux, req)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+		resp, md, err := request_BBSim_RestartDhcp_0(rctx, inboundMarshaler, client, req, pathParams)
+		ctx = runtime.NewServerMetadataContext(ctx, md)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+
+		forward_BBSim_RestartDhcp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+	})
+
 	mux.Handle("POST", pattern_BBSim_SetOnuAlarmIndication_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
 		ctx, cancel := context.WithCancel(req.Context())
 		defer cancel()
@@ -1485,6 +1812,26 @@
 
 	})
 
+	mux.Handle("POST", pattern_BBSim_ChangeIgmpState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+		ctx, cancel := context.WithCancel(req.Context())
+		defer cancel()
+		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+		rctx, err := runtime.AnnotateContext(ctx, mux, req)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+		resp, md, err := request_BBSim_ChangeIgmpState_0(rctx, inboundMarshaler, client, req, pathParams)
+		ctx = runtime.NewServerMetadataContext(ctx, md)
+		if err != nil {
+			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+			return
+		}
+
+		forward_BBSim_ChangeIgmpState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+	})
+
 	mux.Handle("GET", pattern_BBSim_GetOnuTrafficSchedulers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
 		ctx, cancel := context.WithCancel(req.Context())
 		defer cancel()
@@ -1533,6 +1880,10 @@
 
 	pattern_BBSim_PoweronONUsOnPON_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"v1", "olt", "port", "PonPortId", "onus"}, "", runtime.AssumeColonVerbOpt(true)))
 
+	pattern_BBSim_RestartEapol_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"v1", "olt", "onus", "SerialNumber", "eapol"}, "", runtime.AssumeColonVerbOpt(true)))
+
+	pattern_BBSim_RestartDhcp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"v1", "olt", "onus", "SerialNumber", "dhcp"}, "", runtime.AssumeColonVerbOpt(true)))
+
 	pattern_BBSim_SetOnuAlarmIndication_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6}, []string{"v1", "olt", "onus", "SerialNumber", "alarms", "AlarmType", "Status"}, "", runtime.AssumeColonVerbOpt(true)))
 
 	pattern_BBSim_SetOltAlarmIndication_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"v1", "olt", "ports", "InterfaceType", "InterfaceID", "alarms", "los", "Status"}, "", runtime.AssumeColonVerbOpt(true)))
@@ -1541,6 +1892,8 @@
 
 	pattern_BBSim_GetFlows_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "olt", "flows"}, "", runtime.AssumeColonVerbOpt(true)))
 
+	pattern_BBSim_ChangeIgmpState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6}, []string{"v1", "olt", "onus", "OnuReq.SerialNumber", "igmp", "SubActionVal", "GroupAddress"}, "", runtime.AssumeColonVerbOpt(true)))
+
 	pattern_BBSim_GetOnuTrafficSchedulers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"v1", "olt", "onus", "SerialNumber", "trafficschedulers"}, "", runtime.AssumeColonVerbOpt(true)))
 )
 
@@ -1569,6 +1922,10 @@
 
 	forward_BBSim_PoweronONUsOnPON_0 = runtime.ForwardResponseMessage
 
+	forward_BBSim_RestartEapol_0 = runtime.ForwardResponseMessage
+
+	forward_BBSim_RestartDhcp_0 = runtime.ForwardResponseMessage
+
 	forward_BBSim_SetOnuAlarmIndication_0 = runtime.ForwardResponseMessage
 
 	forward_BBSim_SetOltAlarmIndication_0 = runtime.ForwardResponseMessage
@@ -1577,5 +1934,7 @@
 
 	forward_BBSim_GetFlows_1 = runtime.ForwardResponseMessage
 
+	forward_BBSim_ChangeIgmpState_0 = runtime.ForwardResponseMessage
+
 	forward_BBSim_GetOnuTrafficSchedulers_0 = runtime.ForwardResponseMessage
 )
diff --git a/api/bbsim/bbsim.yaml b/api/bbsim/bbsim.yaml
index 5101d08..aacc160 100644
--- a/api/bbsim/bbsim.yaml
+++ b/api/bbsim/bbsim.yaml
@@ -52,6 +52,13 @@
   - selector: bbsim.BBSim.GetOnuTrafficSchedulers
     get: "/v1/olt/onus/{SerialNumber}/trafficschedulers"
 
+  - selector: bbsim.BBSim.RestartEapol
+    post: "/v1/olt/onus/{SerialNumber}/eapol"
+  - selector: bbsim.BBSim.RestartDhcp
+    post: "/v1/olt/onus/{SerialNumber}/dhcp"
+  - selector: bbsim.BBSim.ChangeIgmpState
+    post: "/v1/olt/onus/{OnuReq.SerialNumber}/igmp/{SubActionVal}/{GroupAddress}"
+
   - selector: bbsim.BBSim.SetOnuAlarmIndication
     post: "/v1/olt/onus/{SerialNumber}/alarms/{AlarmType}/{Status}"
   - selector: bbsim.BBSim.SetOltAlarmIndication