Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIG: Move definition of SIG control messages to go/lib/ctrl #3665

Merged
merged 1 commit into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/lib/ctrl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ go_library(
"//go/lib/ctrl/ifid:go_default_library",
"//go/lib/ctrl/path_mgmt:go_default_library",
"//go/lib/ctrl/seg:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/scrypto:go_default_library",
"//go/proto:go_default_library",
"//go/sig/mgmt:go_default_library",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go_library(
"pld.go",
"poll.go",
],
importpath = "github.com/scionproto/scion/go/sig/mgmt",
importpath = "github.com/scionproto/scion/go/lib/ctrl/sig_mgmt",
visibility = ["//visibility:public"],
deps = [
"//go/lib/addr:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/sig/mgmt/addr.go → go/lib/ctrl/sig_mgmt/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package mgmt
package sig_mgmt

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion go/sig/mgmt/common.go → go/lib/ctrl/sig_mgmt/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package mgmt
package sig_mgmt

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion go/sig/mgmt/pld.go → go/lib/ctrl/sig_mgmt/pld.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package mgmt
package sig_mgmt

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion go/sig/mgmt/poll.go → go/lib/ctrl/sig_mgmt/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package mgmt
package sig_mgmt

import (
"fmt"
Expand Down
6 changes: 3 additions & 3 deletions go/lib/ctrl/union.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"github.com/scionproto/scion/go/lib/ctrl/ifid"
"github.com/scionproto/scion/go/lib/ctrl/path_mgmt"
"github.com/scionproto/scion/go/lib/ctrl/seg"
"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
"github.com/scionproto/scion/go/proto"
sigmgmt "github.com/scionproto/scion/go/sig/mgmt"
)

// union represents the contents of the unnamed capnp union.
Expand All @@ -36,7 +36,7 @@ type union struct {
PathMgmt *path_mgmt.Pld
Sibra []byte `capnp:"-"` // Omit for now
DRKeyMgmt []byte `capnp:"-"` // Omit for now
Sig *sigmgmt.Pld
Sig *sig_mgmt.Pld
Extn *extn.CtrlExtnDataList
Ack *ack.Ack
}
Expand All @@ -52,7 +52,7 @@ func (u *union) set(c proto.Cerealizable) error {
case *path_mgmt.Pld:
u.Which = proto.CtrlPld_Which_pathMgmt
u.PathMgmt = p
case *sigmgmt.Pld:
case *sig_mgmt.Pld:
u.Which = proto.CtrlPld_Which_sig
u.Sig = p
case *cert_mgmt.Pld:
Expand Down
2 changes: 1 addition & 1 deletion go/sig/egress/dispatcher/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ go_library(
deps = [
"//go/lib/addr:go_default_library",
"//go/lib/common:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/ringbuf:go_default_library",
"//go/sig/egress/iface:go_default_library",
"//go/sig/internal/metrics:go_default_library",
"//go/sig/mgmt:go_default_library",
],
)
6 changes: 4 additions & 2 deletions go/sig/egress/dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ package dispatcher
import (
"github.com/scionproto/scion/go/lib/addr"
"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/ringbuf"
"github.com/scionproto/scion/go/sig/egress/iface"
"github.com/scionproto/scion/go/sig/internal/metrics"
"github.com/scionproto/scion/go/sig/mgmt"
)

type egressDispatcher struct {
Expand Down Expand Up @@ -69,7 +69,9 @@ func (ed *egressDispatcher) Run() {
ed.Info("EgressDispatcher: stopping")
}

func (ed *egressDispatcher) updateMetrics(remoteIA addr.IAInt, sessId mgmt.SessionType, read int) {
func (ed *egressDispatcher) updateMetrics(remoteIA addr.IAInt, sessId sig_mgmt.SessionType,
read int) {

key := metrics.CtrPairKey{RemoteIA: remoteIA, SessId: sessId}
counters, ok := ed.pktsRecvCounters[key]
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion go/sig/egress/iface/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ go_library(
deps = [
"//go/lib/addr:go_default_library",
"//go/lib/common:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/ringbuf:go_default_library",
"//go/lib/snet:go_default_library",
"//go/lib/spath/spathmeta:go_default_library",
"//go/sig/egress/siginfo:go_default_library",
"//go/sig/mgmt:go_default_library",
],
)
4 changes: 2 additions & 2 deletions go/sig/egress/iface/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (

"github.com/scionproto/scion/go/lib/addr"
"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/ringbuf"
"github.com/scionproto/scion/go/lib/snet"
"github.com/scionproto/scion/go/lib/spath/spathmeta"
"github.com/scionproto/scion/go/sig/egress/siginfo"
"github.com/scionproto/scion/go/sig/mgmt"
)

func Init() {
Expand All @@ -53,7 +53,7 @@ type Session interface {
// IA returns the session's remote IA
IA() addr.IA
// ID returns the session's ID.
ID() mgmt.SessionType
ID() sig_mgmt.SessionType
// Conn returns the session's outbound snet Conn.
// The returned value must be the same for the entire lifetime of the object.
Conn() snet.Conn
Expand Down
2 changes: 1 addition & 1 deletion go/sig/egress/iface/mock_iface/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//go/lib/addr:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/ringbuf:go_default_library",
"//go/lib/snet:go_default_library",
"//go/sig/egress/iface:go_default_library",
"//go/sig/mgmt:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
],
)
6 changes: 3 additions & 3 deletions go/sig/egress/iface/mock_iface/iface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/sig/egress/session/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ go_library(
"//go/lib/addr:go_default_library",
"//go/lib/common:go_default_library",
"//go/lib/ctrl:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/infra:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/pktdisp:go_default_library",
Expand All @@ -25,6 +26,5 @@ go_library(
"//go/sig/internal/metrics:go_default_library",
"//go/sig/internal/pathmgr:go_default_library",
"//go/sig/internal/sigcmn:go_default_library",
"//go/sig/mgmt:go_default_library",
],
)
8 changes: 4 additions & 4 deletions go/sig/egress/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/scionproto/scion/go/lib/addr"
"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/pktdisp"
"github.com/scionproto/scion/go/lib/ringbuf"
Expand All @@ -35,7 +36,6 @@ import (
"github.com/scionproto/scion/go/sig/egress/worker"
"github.com/scionproto/scion/go/sig/internal/pathmgr"
"github.com/scionproto/scion/go/sig/internal/sigcmn"
"github.com/scionproto/scion/go/sig/mgmt"
)

var _ iface.Session = (*Session)(nil)
Expand All @@ -45,7 +45,7 @@ var _ iface.Session = (*Session)(nil)
type Session struct {
log.Logger
ia addr.IA
SessId mgmt.SessionType
SessId sig_mgmt.SessionType

// pool contains paths managed by pathmgr.
pool iface.PathPool
Expand All @@ -62,7 +62,7 @@ type Session struct {
workerStopped chan struct{}
}

func NewSession(dstIA addr.IA, sessId mgmt.SessionType, logger log.Logger,
func NewSession(dstIA addr.IA, sessId sig_mgmt.SessionType, logger log.Logger,
pool iface.PathPool) (*Session, error) {

var err error
Expand Down Expand Up @@ -140,7 +140,7 @@ func (s *Session) IA() addr.IA {
return s.ia
}

func (s *Session) ID() mgmt.SessionType {
func (s *Session) ID() sig_mgmt.SessionType {
return s.SessId
}

Expand Down
11 changes: 6 additions & 5 deletions go/sig/egress/session/sessmon.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (
"github.com/scionproto/scion/go/lib/addr"
"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/ctrl"
"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
"github.com/scionproto/scion/go/lib/infra"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/sig/egress/iface"
"github.com/scionproto/scion/go/sig/egress/siginfo"
"github.com/scionproto/scion/go/sig/internal/disp"
"github.com/scionproto/scion/go/sig/internal/metrics"
"github.com/scionproto/scion/go/sig/internal/sigcmn"
"github.com/scionproto/scion/go/sig/mgmt"
)

const (
Expand Down Expand Up @@ -56,7 +56,7 @@ type sessMonitor struct {
// when sessMonitor is trying to switch SIGs/paths, this is the id of the
// last PollReq sent, so that sessMonitor can correlate replies to the
// remoteInfo used for the request.
updateMsgId mgmt.MsgIdType
updateMsgId sig_mgmt.MsgIdType
// the last time a PollRep was received.
lastReply time.Time
}
Expand Down Expand Up @@ -256,8 +256,9 @@ func (sm *sessMonitor) sendReq() {
if sm.smRemote == nil || sm.smRemote.SessPath == nil {
return
}
sm.updateMsgId = mgmt.MsgIdType(time.Now().UnixNano())
spld, err := mgmt.NewPld(sm.updateMsgId, mgmt.NewPollReq(sigcmn.MgmtAddr, sm.sess.SessId))
sm.updateMsgId = sig_mgmt.MsgIdType(time.Now().UnixNano())
spld, err := sig_mgmt.NewPld(sm.updateMsgId, sig_mgmt.NewPollReq(sigcmn.MgmtAddr,
sm.sess.SessId))
if err != nil {
sm.Error("sessMonitor: Error creating SIGCtrl payload", "err", err)
return
Expand Down Expand Up @@ -292,7 +293,7 @@ func (sm *sessMonitor) sendReq() {
}

func (sm *sessMonitor) handleRep(rpld *disp.RegPld) {
pollRep, ok := rpld.P.(*mgmt.PollRep)
pollRep, ok := rpld.P.(*sig_mgmt.PollRep)
if !ok {
sm.Error("sessMonitor: non-SIGPollRep payload received",
"src", rpld.Addr, "type", common.TypeOf(rpld.P), "pld", rpld.P)
Expand Down
4 changes: 2 additions & 2 deletions go/sig/egress/worker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//go/lib/common:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/l4:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/ringbuf:go_default_library",
Expand All @@ -17,7 +18,6 @@ go_library(
"//go/sig/egress/siginfo:go_default_library",
"//go/sig/internal/metrics:go_default_library",
"//go/sig/internal/sigcmn:go_default_library",
"//go/sig/mgmt:go_default_library",
],
)

Expand All @@ -28,13 +28,13 @@ go_test(
deps = [
"//go/lib/addr:go_default_library",
"//go/lib/common:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/ringbuf:go_default_library",
"//go/lib/snet:go_default_library",
"//go/sig/egress/iface:go_default_library",
"//go/sig/egress/iface/mock_iface:go_default_library",
"//go/sig/egress/worker/mock_worker:go_default_library",
"//go/sig/mgmt:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_stretchr_testify//assert:go_default_library",
],
Expand Down
4 changes: 2 additions & 2 deletions go/sig/egress/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
"github.com/scionproto/scion/go/lib/l4"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/ringbuf"
Expand All @@ -31,7 +32,6 @@ import (
"github.com/scionproto/scion/go/sig/egress/siginfo"
"github.com/scionproto/scion/go/sig/internal/metrics"
"github.com/scionproto/scion/go/sig/internal/sigcmn"
"github.com/scionproto/scion/go/sig/mgmt"
)

// SIG Frame Header, used to encapsulate SIG to SIG traffic. The sequence
Expand Down Expand Up @@ -276,7 +276,7 @@ func (f *frame) startPkt(pktLen uint16) {
f.offset += PktLenSize
}

func (f *frame) writeHdr(sessId mgmt.SessionType, epoch uint16, seq uint32) {
func (f *frame) writeHdr(sessId sig_mgmt.SessionType, epoch uint16, seq uint32) {
f.b[0] = uint8(sessId)
common.Order.PutUint16(f.b[1:3], epoch)
common.Order.PutUintN(f.b[3:6], uint64(seq), 3)
Expand Down
4 changes: 2 additions & 2 deletions go/sig/egress/worker/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (

"github.com/scionproto/scion/go/lib/addr"
"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/ringbuf"
"github.com/scionproto/scion/go/lib/snet"
"github.com/scionproto/scion/go/sig/egress/iface"
"github.com/scionproto/scion/go/sig/egress/iface/mock_iface"
"github.com/scionproto/scion/go/sig/egress/worker/mock_worker"
"github.com/scionproto/scion/go/sig/mgmt"
)

func TestMain(m *testing.M) {
Expand Down Expand Up @@ -109,7 +109,7 @@ func (wt *WorkerTester) Run() {
ia, _ := addr.IAFromString("1-ff00:0:300")
s := mock_iface.NewMockSession(wt.mockCtrl)
s.EXPECT().IA().AnyTimes().Return(ia)
s.EXPECT().ID().AnyTimes().Return(mgmt.SessionType(0))
s.EXPECT().ID().AnyTimes().Return(sig_mgmt.SessionType(0))
s.EXPECT().Conn().AnyTimes().Return(nil)
s.EXPECT().Ring().AnyTimes().Return(wt.ring)
s.EXPECT().Remote().AnyTimes().Return(nil)
Expand Down
2 changes: 1 addition & 1 deletion go/sig/internal/base/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ go_library(
"//go/lib/addr:go_default_library",
"//go/lib/common:go_default_library",
"//go/lib/ctrl:go_default_library",
"//go/lib/ctrl/sig_mgmt:go_default_library",
"//go/lib/infra:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/snet:go_default_library",
"//go/sig/internal/disp:go_default_library",
"//go/sig/internal/sigcmn:go_default_library",
"//go/sig/mgmt:go_default_library",
],
)
Loading