Skip to content

Commit 7a8d580

Browse files
ciarandAalyria Technologies, Inc.
andauthored
Project import generated by Copybara. (#86)
GitOrigin-RevId: 30a2f95d5b9e12f4c954f1ecc02b0c720314ab95 Co-authored-by: Aalyria Technologies, Inc. <[email protected]>
1 parent 507262e commit 7a8d580

File tree

24 files changed

+400
-444
lines changed

24 files changed

+400
-444
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bazel_dep(name = "gazelle", version = "0.35.0")
3838
bazel_dep(name = "container_structure_test", version = "1.16.0", dev_dependency = True)
3939

4040
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
41-
go_sdk.download(version = "1.22.3")
41+
go_sdk.download(version = "1.22.5")
4242

4343
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
4444
oci.pull(

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ go_rules_dependencies()
135135

136136
# Install the Go toolchains. (https://github.com/bazelbuild/rules_go/blob/master/go/toolchains.rst#go-toolchain)
137137
go_register_toolchains(
138-
version = "1.22.3",
138+
version = "1.22.5",
139139
)
140140

141141
gazelle_dependencies()

api/nbi/v1alpha/resources/intent.proto

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,21 +205,42 @@ message ModemIntent {
205205
message Beam {
206206
optional BeamTarget target = 1;
207207

208-
optional BeamConfiguration rx = 2;
209-
optional BeamConfiguration tx = 3;
208+
optional RxConfiguration rx = 2;
209+
optional TxConfiguration tx = 3;
210210

211211
// The collection of endpoints served by the beam.
212212
// For example, a collection of user terminals (UTs) served.
213213
//
214214
// Each endpoint is the ID of a network node in Spacetime's network model.
215-
repeated string endpoints = 4;
215+
repeated Endpoint endpoints = 4;
216216
}
217217

218-
message BeamConfiguration {
218+
message RxConfiguration {
219219
optional uint64 center_frequency_hz = 1;
220220
optional uint64 channel_bandwidth_hz = 2;
221221
optional Polarization polarization = 3;
222+
223+
// Symbol rate in Megasymbols per second.
224+
optional double symbol_rate_msps = 5;
225+
226+
optional ModemMode mode = 4;
227+
}
228+
229+
message TxConfiguration {
230+
optional uint64 center_frequency_hz = 1;
231+
optional uint64 channel_bandwidth_hz = 2;
232+
optional Polarization polarization = 3;
233+
234+
// Transmit power in Watts.
235+
optional double power_w = 5;
236+
237+
// Symbol rate in Megasymbols per second.
238+
optional double symbol_rate_msps = 6;
239+
222240
optional ModemMode mode = 4;
241+
242+
// The lowest MODCOD common among all endpoints.
243+
optional string lowest_common_modcod = 7;
223244
}
224245

225246
enum Polarization {
@@ -234,6 +255,13 @@ enum ModemMode {
234255
MODEM_MODE_DVB_S2X = 2;
235256
}
236257

258+
message Endpoint {
259+
optional string id = 1;
260+
optional string lowest_supported_rx_modcod = 2;
261+
optional double rx_reference_throughput_bps = 3;
262+
optional double tx_reference_throughput_bps = 4;
263+
}
264+
237265
// IntentFailure provides context on the failure of an intent. It's purpose is
238266
// to allow apps to make better decision when faced with failures.
239267
message IntentFailure {

api/scheduling/v1alpha/scheduling.proto

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,23 +200,27 @@ message Beam {
200200

201201
// Parameters specifying the configuration of the beam in the receive
202202
// direction. Absent if the beam is to be used for transmit only.
203-
BeamConfiguration rx = 2;
203+
RxConfiguration rx = 2;
204204

205-
// Parameters specifying the configuration of the beam in the receive
205+
// Parameters specifying the configuration of the beam in the transmit
206206
// direction. Absent if the beam is to be used for receiving only.
207-
BeamConfiguration tx = 3;
207+
TxConfiguration tx = 3;
208208

209209
// The collection of endpoints served by the beam.
210210
// For example, a collection of user terminals (UTs) served.
211211
//
212212
// Each endpoint is the ID of a network node in Spacetime's network model.
213-
repeated string endpoints = 4;
213+
repeated Endpoint endpoints = 4;
214+
215+
// ID of the beam shape.
216+
string shape_id = 5;
214217
}
215218

216219
message BeamTarget {
217220
oneof target {
218221
Ecef ecef = 1;
219222
string ccsds_oem_file_content = 2;
223+
AzEl az_el = 3;
220224
}
221225
}
222226

@@ -226,13 +230,48 @@ message Ecef {
226230
int64 z_m = 3;
227231
}
228232

229-
message BeamConfiguration {
233+
// An azimuth and elevation angle pair.
234+
//
235+
// The azimuth angle of a vector is the angle between the x-axis and the
236+
// orthogonal projection of the vector onto the xy plane. The angle is positive
237+
// in going from the x axis toward the y axis. The elevation angle is the angle
238+
// between the vector and its orthogonal projection onto the xy-plane.
239+
message AzEl {
240+
// Azimuth, in degrees.
241+
double az_deg = 1;
242+
243+
// Elevation, in degrees.
244+
double el_deg = 2;
245+
}
246+
247+
message RxConfiguration {
230248
uint64 center_frequency_hz = 1;
231249
uint64 channel_bandwidth_hz = 2;
232250
Polarization polarization = 3;
251+
252+
// Symbol rate in Megasymbols per second.
253+
double symbol_rate_msps = 5;
254+
233255
ModemMode mode = 4;
234256
}
235257

258+
message TxConfiguration {
259+
uint64 center_frequency_hz = 1;
260+
uint64 channel_bandwidth_hz = 2;
261+
Polarization polarization = 3;
262+
263+
// Transmit power in Watts.
264+
double power_w = 5;
265+
266+
// Symbol rate in Megasymbols per second.
267+
double symbol_rate_msps = 6;
268+
269+
ModemMode mode = 4;
270+
271+
// The lowest MODCOD common among all endpoints.
272+
string lowest_common_modcod = 7;
273+
}
274+
236275
enum Polarization {
237276
POLARIZATION_UNSPECIFIED = 0;
238277
POLARIZATION_LHCP = 1; // Left-handed circular polarization
@@ -245,6 +284,13 @@ enum ModemMode {
245284
MODEM_MODE_DVB_S2X = 2;
246285
}
247286

287+
message Endpoint {
288+
string id = 1;
289+
string lowest_supported_rx_modcod = 2;
290+
double rx_reference_throughput_bps = 3;
291+
double tx_reference_throughput_bps = 4;
292+
}
293+
248294
// A Segment Routing Policy Architecture policy description.
249295
// Based in part upon elements from:
250296
// * RFC 9256

cdpi_agent/agent.go

Lines changed: 24 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ import (
2222
"fmt"
2323
"sync"
2424

25-
afpb "aalyria.com/spacetime/api/cdpi/v1alpha"
26-
apipb "aalyria.com/spacetime/api/common"
27-
schedpb "aalyria.com/spacetime/api/scheduling/v1alpha"
2825
"aalyria.com/spacetime/cdpi_agent/enactment"
2926
"aalyria.com/spacetime/cdpi_agent/internal/task"
3027
"aalyria.com/spacetime/cdpi_agent/telemetry"
@@ -46,7 +43,6 @@ func init() {
4643

4744
var (
4845
errNoClock = errors.New("no clock provided (see WithClock)")
49-
errNoEndpoint = errors.New("no server endpoint provied (see WithServerEndpoint)")
5046
errNoNodes = errors.New("no nodes configured (see WithNode)")
5147
errNoActiveServices = errors.New("no services configured for node (see WithEnactmentBackend and WithTelemetryBackend)")
5248
)
@@ -71,17 +67,14 @@ func (fn nodeOptFunc) apply(n *node) { fn(n) }
7167
// Agent is a CDPI agent that coordinates change requests across multiple
7268
// nodes.
7369
type Agent struct {
74-
clock clockwork.Clock
75-
nodes map[string]*node
76-
endpoint string
77-
dialOpts []grpc.DialOption
70+
clock clockwork.Clock
71+
nodes map[string]*node
7872
}
7973

8074
// NewAgent creates a new Agent configured with the provided options.
8175
func NewAgent(opts ...AgentOption) (*Agent, error) {
8276
a := &Agent{
83-
nodes: map[string]*node{},
84-
dialOpts: []grpc.DialOption{grpc.WithBlock()},
77+
nodes: map[string]*node{},
8578
}
8679

8780
for _, opt := range opts {
@@ -96,9 +89,6 @@ func (a *Agent) validate() error {
9689
if a.clock == nil {
9790
errs = append(errs, errNoClock)
9891
}
99-
if a.endpoint == "" {
100-
errs = append(errs, errNoEndpoint)
101-
}
10292
if len(a.nodes) == 0 {
10393
errs = append(errs, errNoNodes)
10494
}
@@ -122,25 +112,6 @@ func WithRealClock() AgentOption {
122112
return WithClock(clockwork.NewRealClock())
123113
}
124114

125-
// WithServerEndpoint configures the Agent to connect to the provided endpoint.
126-
func WithServerEndpoint(endpoint string) AgentOption {
127-
return agentOptFunc(func(a *Agent) {
128-
a.endpoint = endpoint
129-
})
130-
}
131-
132-
// WithDialOpts configures the Agent to use the provided DialOptions when
133-
// connecting to the CDPI endpoint.
134-
//
135-
// NOTE: The CDPI agent always uses the `grpc.WithBlock` option to ensure
136-
// initial connection errors are caught immediately, whereas logical errors are
137-
// often more tightly scoped to individual RPCs.
138-
func WithDialOpts(dialOpts ...grpc.DialOption) AgentOption {
139-
return agentOptFunc(func(a *Agent) {
140-
a.dialOpts = append(a.dialOpts, dialOpts...)
141-
})
142-
}
143-
144115
// WithNode configures a network node for the agent to represent.
145116
func WithNode(id string, opts ...NodeOption) AgentOption {
146117
n := &node{id: id}
@@ -153,42 +124,36 @@ func WithNode(id string, opts ...NodeOption) AgentOption {
153124
}
154125

155126
type node struct {
156-
initState *apipb.ControlPlaneState
157-
eb enactment.Backend
158-
tb telemetry.Backend
159-
id string
160-
priority uint32
161-
enactmentsEnabled bool
162-
telemetryEnabled bool
163-
}
127+
ed enactment.Driver
128+
td telemetry.Driver
129+
id string
130+
priority uint32
164131

165-
func WithChannelPriority(priority uint32) NodeOption {
166-
return nodeOptFunc(func(n *node) { n.priority = priority })
132+
enactmentEndpoint, telemetryEndpoint string
133+
enactmentsEnabled, telemetryEnabled bool
134+
enactmentDialOpts, telemetryDialOpts []grpc.DialOption
167135
}
168136

169-
// WithEnactmentBackend configures the EnactmentBackend for the given Node.
170-
func WithEnactmentBackend(eb enactment.Backend) NodeOption {
137+
// WithEnactmentDriver configures the [enactment.Driver] for the given Node.
138+
func WithEnactmentDriver(endpoint string, d enactment.Driver, dialOpts ...grpc.DialOption) NodeOption {
171139
return nodeOptFunc(func(n *node) {
172-
n.eb = eb
140+
n.ed = d
141+
n.enactmentEndpoint = endpoint
142+
n.enactmentDialOpts = dialOpts
173143
n.enactmentsEnabled = true
174144
})
175145
}
176146

177-
// WithTelemetryBackend configures the telemetry.Backend for the given Node.
178-
func WithTelemetryBackend(tb telemetry.Backend) NodeOption {
147+
// WithTelemetryDriver configures the [telemetry.Driver] for the given Node.
148+
func WithTelemetryDriver(endpoint string, d telemetry.Driver, dialOpts ...grpc.DialOption) NodeOption {
179149
return nodeOptFunc(func(n *node) {
180-
n.tb = tb
150+
n.td = d
151+
n.telemetryEndpoint = endpoint
152+
n.telemetryDialOpts = dialOpts
181153
n.telemetryEnabled = true
182154
})
183155
}
184156

185-
// WithInitialState configures the initial state of the Node.
186-
func WithInitialState(initState *apipb.ControlPlaneState) NodeOption {
187-
return nodeOptFunc(func(n *node) {
188-
n.initState = initState
189-
})
190-
}
191-
192157
// Run starts the Agent and blocks until a fatal error is encountered or all
193158
// node controllers terminate.
194159
func (a *Agent) Run(ctx context.Context) error {
@@ -226,21 +191,13 @@ func (a *Agent) Run(ctx context.Context) error {
226191
}
227192

228193
func (a *Agent) start(ctx context.Context, agentMap *expvar.Map, errCh chan error) error {
229-
log := zerolog.Ctx(ctx)
230-
231-
log.Trace().Str("endpoint", a.endpoint).Msg("contacting the CDPI endpoint")
232-
conn, err := grpc.NewClient(a.endpoint, a.dialOpts...)
233-
if err != nil {
234-
return fmt.Errorf("agent: failed connecting to CDPI backend: %w", err)
235-
}
236-
237-
schedClient := schedpb.NewSchedulingClient(conn)
238-
telemetryClient := afpb.NewNetworkTelemetryStreamingClient(conn)
239-
240194
for _, n := range a.nodes {
241195
ctx, done := context.WithCancel(ctx)
242196

243-
nc := a.newNodeController(n, done, schedClient, telemetryClient)
197+
nc, err := a.newNodeController(n, done)
198+
if err != nil {
199+
return fmt.Errorf("node %q: %w", n.id, err)
200+
}
244201
agentMap.Set(n.id, expvar.Func(nc.Stats))
245202

246203
srv := task.Task(nc.run).

cdpi_agent/agent_test.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,9 @@ func TestAgentValidation_noOptions(t *testing.T) {
2727
}
2828
}
2929

30-
func TestAgentValidation_onlyClock(t *testing.T) {
31-
t.Parallel()
32-
_, err := NewAgent(WithRealClock())
33-
if !errors.Is(err, errNoEndpoint) {
34-
t.Errorf("expected NewAgent with no endpoint to cause %s, but got %v error instead", errNoEndpoint, err)
35-
}
36-
}
37-
38-
func TestAgentValidation_onlyEndpoint(t *testing.T) {
39-
t.Parallel()
40-
_, err := NewAgent(WithServerEndpoint("dns:///example.com:443"))
41-
if !errors.Is(err, errNoClock) {
42-
t.Errorf("expected NewAgent with no clock to cause %s, but got %v error instead", errNoClock, err)
43-
}
44-
}
45-
4630
func TestAgentValidation_noNodes(t *testing.T) {
4731
t.Parallel()
48-
_, err := NewAgent(
49-
WithServerEndpoint("dns:///example.com:443"),
50-
WithRealClock())
32+
_, err := NewAgent(WithRealClock())
5133

5234
if !errors.Is(err, errNoNodes) {
5335
t.Errorf("expected NewAgent with no nodes to cause %s, but got %v error instead", errNoNodes, err)
@@ -57,7 +39,6 @@ func TestAgentValidation_noNodes(t *testing.T) {
5739
func TestAgentValidation_noServices(t *testing.T) {
5840
t.Parallel()
5941
_, err := NewAgent(
60-
WithServerEndpoint("dns:///example.com:443"),
6142
WithRealClock(),
6243
WithNode("a"),
6344
WithNode("b"),

cdpi_agent/enactment/BUILD

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@ go_library(
2020
name = "enactment",
2121
srcs = ["enactment.go"],
2222
importpath = "aalyria.com/spacetime/cdpi_agent/enactment",
23-
deps = [
24-
"//api/common:common_go_proto",
25-
"//api/scheduling/v1alpha:scheduling_go_grpc",
26-
],
23+
deps = ["//api/scheduling/v1alpha:scheduling_go_grpc"],
2724
)

0 commit comments

Comments
 (0)