CloudConfig Dynamic NW schema
This commit is contained in:
@@ -132,6 +132,15 @@ public class BoshCloudConfigSchema extends SchemaSupport implements YamlSchema {
|
||||
AbstractType t_dynamic_nw = f.ybean("DynamicNetwork");
|
||||
addProp(t_dynamic_nw, "dns", f.yseq(t_ip_address));
|
||||
addProp(t_dynamic_nw, "cloud_properties", t_params);
|
||||
{
|
||||
YBeanType t_subnet = f.ybean("Subnet[Dynamic]");
|
||||
addProp(t_subnet, "dns", f.yseq(t_ip_address));
|
||||
addProp(t_subnet, "az", t_az_ref);
|
||||
addProp(t_subnet, "azs", f.yseq(t_az_ref));
|
||||
addProp(t_subnet, "cloud_properties", t_params);
|
||||
|
||||
addProp(t_dynamic_nw, "subnets", f.yseq(t_subnet));
|
||||
}
|
||||
|
||||
t_dynamic_nw.require(Constraints.mutuallyExclusive("dns", "subnets"));
|
||||
t_dynamic_nw.require(Constraints.mutuallyExclusive("cloud_properties", "subnets"));
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Describes any IaaS-specific properties for the network. Default is {} (empty Hash).
|
||||
|
||||
See:
|
||||
|
||||
- [AWS CPI network cloud properties](https://bosh.io/docs/aws-cpi.html#networks)
|
||||
- [Azure CPI network cloud properties](https://bosh.io/docs/azure-cpi.html#networks)
|
||||
- [OpenStack CPI network cloud properties](https://bosh.io/docs/openstack-cpi.html#networks)
|
||||
- [Softlayer CPI network cloud properties](https://bosh.io/docs/softlayer-cpi.html#networks)
|
||||
- [Google Cloud Platform CPI network cloud properties](https://bosh.io/docs/google-cpi.html#networks)
|
||||
- [vSphere CPI network cloud properties](https://bosh.io/docs/vsphere-cpi.html#networks)
|
||||
- [vCloud CPI network cloud properties](https://bosh.io/docs/vcloud-cpi.html#networks)
|
||||
@@ -0,0 +1 @@
|
||||
DNS IP addresses for this network.
|
||||
@@ -0,0 +1 @@
|
||||
Lists subnets in this network.
|
||||
@@ -0,0 +1 @@
|
||||
AZ associated with this subnet (should only be used when using [first class AZs](https://bosh.io/docs/azs.html)). Example: `z1`.
|
||||
@@ -0,0 +1 @@
|
||||
List of AZs associated with this subnet (should only be used when using [first class AZs](https://bosh.io/docs/azs.html)). Example: `[z1, z2]`.
|
||||
@@ -0,0 +1,11 @@
|
||||
Describes any IaaS-specific properties for the subnet. Default is {} (empty Hash).
|
||||
|
||||
See:
|
||||
|
||||
- [AWS CPI network cloud properties](https://bosh.io/docs/aws-cpi.html#networks)
|
||||
- [Azure CPI network cloud properties](https://bosh.io/docs/azure-cpi.html#networks)
|
||||
- [OpenStack CPI network cloud properties](https://bosh.io/docs/openstack-cpi.html#networks)
|
||||
- [Softlayer CPI network cloud properties](https://bosh.io/docs/softlayer-cpi.html#networks)
|
||||
- [Google Cloud Platform CPI network cloud properties](https://bosh.io/docs/google-cpi.html#networks)
|
||||
- [vSphere CPI network cloud properties](https://bosh.io/docs/vsphere-cpi.html#networks)
|
||||
- [vCloud CPI network cloud properties](https://bosh.io/docs/vcloud-cpi.html#networks)
|
||||
@@ -0,0 +1 @@
|
||||
DNS IP addresses for this subnet.
|
||||
@@ -2227,4 +2227,78 @@ public class BoshEditorTest {
|
||||
editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties for the subnet");
|
||||
}
|
||||
|
||||
@Test public void cloudconfig_dynamic_network_ca() throws Exception {
|
||||
Editor editor;
|
||||
|
||||
editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG,
|
||||
"networks:\n" +
|
||||
"- name: foo\n" +
|
||||
" type: dynamic\n" +
|
||||
" <*>"
|
||||
);
|
||||
editor.assertContextualCompletions(PLAIN_COMPLETION,
|
||||
"<*>"
|
||||
, // ==>
|
||||
"cloud_properties:\n" +
|
||||
" <*>"
|
||||
,
|
||||
"dns:\n" +
|
||||
" - <*>"
|
||||
,
|
||||
"subnets:\n" +
|
||||
" - <*>"
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void cloudconfig_dynamic_network_mutex_props_reconcile() throws Exception {
|
||||
//There are essentially two alternate schemas for dynamic NW config. Because we have simply unified them into one (merged all properties)...
|
||||
// some properties can not be used together because they belong to different sub-schemas.
|
||||
Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG,
|
||||
"networks:\n" +
|
||||
"- name: foo\n" +
|
||||
" type: dynamic\n" +
|
||||
" dns: []\n" +
|
||||
" cloud_properties: {}\n" +
|
||||
" subnets: []"
|
||||
);
|
||||
editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
|
||||
editor.assertProblems(
|
||||
"dns|Only one of 'dns' and 'subnets' should be defined",
|
||||
"cloud_properties|Only one of 'cloud_properties' and 'subnets' should be defined"
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void cloudconfig_dynamic_network_hovers() throws Exception {
|
||||
Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG,
|
||||
"networks:\n" +
|
||||
"- name: foo\n" +
|
||||
" type: dynamic\n" +
|
||||
" dns: []\n" +
|
||||
" cloud_properties: {}\n"
|
||||
);
|
||||
editor.assertHoverContains("name", "Name used to reference this network configuration");
|
||||
editor.assertHoverContains("type", "The type of configuration");
|
||||
editor.assertHoverContains("dns", "DNS IP addresses for this network");
|
||||
editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties for the network");
|
||||
|
||||
editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG,
|
||||
"networks:\n" +
|
||||
"- name: my-network\n" +
|
||||
" type: dynamic\n" +
|
||||
" subnets:\n" +
|
||||
" - az: z1\n" +
|
||||
" dns: []\n" +
|
||||
" cloud_properties: {subnet: subnet-9be6c3f7}\n" +
|
||||
" - azs: [z2, z3]\n" +
|
||||
" cloud_properties: {subnet: subnet-9be6c384}"
|
||||
);
|
||||
editor.assertHoverContains("name", "Name used to reference this network configuration");
|
||||
editor.assertHoverContains("type", "The type of configuration");
|
||||
editor.assertHoverContains("subnets", "Lists subnets in this network");
|
||||
editor.assertHoverContains("dns", "DNS IP addresses for this subnet");
|
||||
editor.assertHoverContains("az", "AZ associated with this subnet");
|
||||
editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties for the subnet");
|
||||
editor.assertHoverContains("azs", "List of AZs associated with this subnet");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user