Skip to content

Commit ac10ece

Browse files
committed
Return "adb_port".
Bug: b/504700123
1 parent 02d52a1 commit ac10ece

9 files changed

Lines changed: 21 additions & 0 deletions

File tree

e2etests/orchestration/create_from_images_zip_test/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func TestCreateInstance(t *testing.T) {
9494
Displays: []string{"720 x 1280 ( 320 )"},
9595
WebRTCDeviceID: "cvd-1",
9696
ADBSerial: "0.0.0.0:6520",
97+
ADBPort: 6520,
9798
},
9899
},
99100
}

e2etests/orchestration/create_local_image_test/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func TestInstance(t *testing.T) {
102102
Displays: []string{"720 x 1280 ( 320 )"},
103103
WebRTCDeviceID: "cvd-1",
104104
ADBSerial: "0.0.0.0:6520",
105+
ADBPort: 6520,
105106
},
106107
},
107108
}

e2etests/orchestration/create_single_instance_test/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func TestCreateSingleInstance(t *testing.T) {
8484
Displays: []string{"720 x 1280 ( 320 )"},
8585
WebRTCDeviceID: "cvd-1-1",
8686
ADBSerial: "0.0.0.0:6520",
87+
ADBPort: 6520,
8788
},
8889
},
8990
}

frontend/src/host_orchestrator/api/v1/messages.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ type CVD struct {
116116
WebRTCDeviceID string `json:"webrtc_device_id"`
117117
// [Output Only]
118118
ADBSerial string `json:"adb_serial"`
119+
// [Output Only]
120+
ADBPort uint32 `json:"adb_port"`
119121
}
120122

121123
// Identifier within the whole fleet. Format: "{group}/{name}".

frontend/src/host_orchestrator/docs/swagger.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ definitions:
6969
type: object
7070
v1.CVD:
7171
properties:
72+
adb_port:
73+
description: '[Output Only]'
74+
type: integer
7275
adb_serial:
7376
description: '[Output Only]'
7477
type: string

frontend/src/host_orchestrator/orchestrator/cvd/cvd.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,13 @@ func (i *Instance) ADBSerial() string {
376376
return i.instance.ADBSerial
377377
}
378378

379+
func (i *Instance) ADBPort() uint32 {
380+
if i.instance == nil {
381+
panic("Lazy loaded instance is not yet initialized")
382+
}
383+
return i.instance.ADBPort
384+
}
385+
379386
type DisplayAddOpts struct {
380387
Width int
381388
Height int

frontend/src/host_orchestrator/orchestrator/cvd/output/output.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type Instance struct {
3030
InstanceDir string `json:"instance_dir"`
3131
WebRTCDeviceID string `json:"webrtc_device_id"`
3232
ADBSerial string `json:"adb_serial"`
33+
ADBPort uint32 `json:"adb_port"`
3334
}
3435

3536
// The output of the cvd fleet command

frontend/src/host_orchestrator/orchestrator/instancemanager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func CvdInstanceToAPIObject(instance *cvd.Instance, group string) *apiv1.CVD {
6565
Displays: instance.Displays(),
6666
WebRTCDeviceID: instance.WebRTCDeviceID(),
6767
ADBSerial: instance.ADBSerial(),
68+
ADBPort: instance.ADBPort(),
6869
}
6970
}
7071

frontend/src/host_orchestrator/orchestrator/listcvdsaction_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestListCVDsSucceeds(t *testing.T) {
3737
"group_name": "foo",
3838
"instances": [
3939
{
40+
"adb_port": 6520,
4041
"adb_serial": "0.0.0.0:6520",
4142
"assembly_dir": "/var/lib/cuttlefish-common/runtimes/cuttlefish/assembly",
4243
"displays": [
@@ -55,6 +56,7 @@ func TestListCVDsSucceeds(t *testing.T) {
5556
"group_name": "bar",
5657
"instances": [
5758
{
59+
"adb_port": 6520,
5860
"adb_serial": "0.0.0.0:6520",
5961
"assembly_dir": "/var/lib/cuttlefish-common/runtimes/cuttlefish/assembly",
6062
"displays": [
@@ -89,6 +91,7 @@ func TestListCVDsSucceeds(t *testing.T) {
8991
Displays: []string{"720 x 1280 ( 320 )"},
9092
WebRTCDeviceID: "cvd-1",
9193
ADBSerial: "0.0.0.0:6520",
94+
ADBPort: 6520,
9295
},
9396
{
9497
Group: "bar",
@@ -98,6 +101,7 @@ func TestListCVDsSucceeds(t *testing.T) {
98101
Displays: []string{"720 x 1280 ( 320 )"},
99102
WebRTCDeviceID: "cvd-1",
100103
ADBSerial: "0.0.0.0:6520",
104+
ADBPort: 6520,
101105
},
102106
}
103107
var tests = []struct {

0 commit comments

Comments
 (0)