Skip to content
Snippets Groups Projects
Commit c458d9cf authored by Martin Stiemerling's avatar Martin Stiemerling :speech_balloon:
Browse files

Replaced UUID on remote for opaque string.

parent c507171c
No related branches found
No related tags found
1 merge request!237Adding initial ETSI 20 border node protocol and mechanics
Pipeline #219416 failed
......@@ -3,6 +3,7 @@ package etsi20bordernode
import (
"context"
"crypto/tls"
"fmt"
"net/http"
log "github.com/sirupsen/logrus"
......@@ -25,7 +26,8 @@ func NewETSI20BorderNodeClient(exitID uuid.UUID, exitAddr string) *ETSI20BorderN
}
}
func (e *ETSI20BorderNodeClient) ETSI20ForwardExternal(initiatorSaeId uuid.UUID, targetSaeId uuid.UUID, keys []crypto.KSAKey) error {
// func (e *ETSI20BorderNodeClient) ETSI20ForwardExternal(initiatorSaeId uuid.UUID, targetSaeId uuid.UUID, keys []crypto.KSAKey) error.
func (e *ETSI20BorderNodeClient) ETSI20ForwardExternal(initiatorSaeId string, targetSaeId string, keys []crypto.KSAKey) error {
// TODO: for demo only
ackCallbackURL := "http://localhost:4545"
......@@ -43,13 +45,14 @@ func (e *ETSI20BorderNodeClient) ETSI20ForwardExternal(initiatorSaeId uuid.UUID,
var targetSaeIds e20.TargetSaeIds
targetSaeIds = append(targetSaeIds, targetSaeId.String())
//targetSaeIds = append(targetSaeIds, targetSaeId.String())
targetSaeIds = append(targetSaeIds, targetSaeId)
postBody := e20.ExtKeyContainer{
AckCallbackUrl: ackCallbackURL,
ExtensionMandatory: nil, // not needed
ExtensionOptional: nil, // not needed
InitiatorSaeId: initiatorSaeId.String(),
InitiatorSaeId: initiatorSaeId,
Keys: e20Keys,
TargetSaeIds: targetSaeIds,
}
......@@ -65,13 +68,18 @@ func (e *ETSI20BorderNodeClient) ETSI20ForwardExternal(initiatorSaeId uuid.UUID,
client, _ := e20.NewClientWithResponses(e.e20BNLocalExitHTTPAddress, clientHandler)
ctx := context.Background()
log.Printf("(ETSI20ForwardExternal) Asking for key forwarding with PostExtKeys with BN %s, initSAEDID %s, targetSAEID %s", e.e20BNLocalExitHTTPAddress, initiatorSaeId.String(), targetSaeId)
log.Printf("(ETSI20ForwardExternal) Asking for key forwarding with PostExtKeys with BN %s, initSAEDID %s, targetSAEID %s", e.e20BNLocalExitHTTPAddress, initiatorSaeId, targetSaeId)
postReponse, err := client.PostExtKeys(ctx, postBody)
if err != nil {
log.Printf("Client PostExtKeys failed %s", err)
log.Printf("(ETSI20ForwardExternal) Client PostExtKeys Transport failed %s", err)
return err
}
log.Printf("(ETSI20ForwardExternal) postResponse %s", postReponse.Status)
// Needs better error handling for HTTP responses and ETSI20
if postReponse.StatusCode != 202 {
log.Printf("(ETSI20ForwardExternal) Client PostExtKeys failed with HTTP status %d %s", postReponse.StatusCode, postReponse.Status)
return fmt.Errorf("(ETSI20ForwardExternal) Client PostExtKeys failed with HTTP status %d %s", postReponse.StatusCode, postReponse.Status)
}
return nil
}
......@@ -331,8 +331,12 @@ func (s *kmsTalkerServer) KeyDelivery(ctx context.Context, in *pb.KeyDeliveryReq
idString, httpAString := s.kms.ETSI20BorderNodeServer.GetE20BNLocalExit()
e20bnClient := e20bn.NewETSI20BorderNodeClient(idString, httpAString)
/* UUID based not for the demo
initID, _ := uuid.Parse(in.GetE20InitatorSaeID())
targetID, _ := uuid.Parse(in.GetE20TargetSaeIDs()[0])
err = e20bnClient.ETSI20ForwardExternal(initID, targetID, akmsKSAKeys) */
initID := in.GetE20InitatorSaeID()
targetID := in.GetE20InitatorSaeID()
err = e20bnClient.ETSI20ForwardExternal(initID, targetID, akmsKSAKeys)
if err != nil {
log.Errorf("(ETSI20 cannot forward to ETSI20 bordnernode %s due to %s", httpAString, err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment