aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/javascript/propertyController.test.js
blob: fbbc6beca83c67edceb20b85d94afc84cd229b58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
describe('Property controller tests', function() {
	var clModel = '{"name": "ClosedLoopTest","dcaeDeploymentId":"testId","dcaeDeploymentStatusUrl":"testUrl","lastComputedState":"DESIGN","svgRepresentation": "representation","globalPropertiesJson": [{"name":"deployParameters","value":{"location_id":"","service_id":"","policy_id":"AUTO_GENERATED_POLICY_ID_AT_SUBMIT"}}], "blueprint": "yaml","lastComputedState": "DESIGN","operationalPolicies": [ {"name": "OpPolicyTest", "configurationsJson": { "policy1": [{"name": "pname","value": "policy1"}]}}],"microServicePolicies": [{"name": "tca","properties": "", "shared": true,"policyTosca": "tosca","jsonRepresentation": {"schema":{"title":"DCAE TCA Config","type":"object","required":["name"],"properties":{"name":{"propertyOrder":101,"title":"Name","type":"string"}}}}}],"loopLogs": [{ } ] }';
	cl_props = JSON.parse(clModel);
	var propertyController = require('scripts/propertyController.js');
	
	test('getOperationalPolicyProperty', () => {
		var policyProp = '{"policy1": [{"name": "pname","value": "policy1"}]}';
		expect(propertyController.getOperationalPolicyProperty()).toEqual(JSON.parse(policyProp));
	});

	test('getGlobalProperty', () => {
		var globalProp = '[{"name":"deployParameters","value":{"location_id":"","service_id":"","policy_id":"AUTO_GENERATED_POLICY_ID_AT_SUBMIT"}}]';
		expect(propertyController.getGlobalProperty()).toEqual(JSON.parse(globalProp));
	});

	test('getMsPropertyTca', () => {
		expect(propertyController.getMsProperty("tca")).toEqual('');
	});

	test('getMsUITca', () => {
		var msUI = '{"schema":{"title":"DCAE TCA Config","type":"object","required":["name"],"properties":{"name":{"propertyOrder":101,"title":"Name","type":"string"}}}}';
		expect(propertyController.getMsUI("tca")).toEqual(JSON.parse(msUI));
	});

	test('getMsPropertyNotExist', () => {
		  expect(propertyController.getMsProperty("test")).toEqual(null);
	});

	test('getMsUINotExist', () => {
		  expect(propertyController.getMsUI("test")).toEqual(null);
	});

	test('getLastUpdatedStatus', () => {
		  expect(propertyController.getLastUpdatedStatus()).toEqual('DESIGN');
	});

	test('getDeploymentID', () => {
		  expect(propertyController.getDeploymentID()).toEqual('testId');
	});

	test('getDeploymentStatusURL', () => {
		  expect(propertyController.getDeploymentStatusURL()).toEqual('testUrl');
	});
});
="l l-Scalar l-Scalar-Plain">security group used by ONAP rules: # All egress traffic - direction: egress ethertype: IPv4 - direction: egress ethertype: IPv6 # ingress traffic # ICMP - protocol: icmp - protocol: udp port_range_min: 1 port_range_max: 65535 - protocol: tcp port_range_min: 1 port_range_max: 65535 # ONAP management private network oam_network: type: OS::Neutron::Net properties: name: str_replace: template: oam_network_rand params: rand: { get_resource: random-str } oam_subnet: type: OS::Neutron::Subnet properties: name: str_replace: template: oam_network_rand params: rand: { get_resource: random-str } network_id: { get_resource: oam_network } cidr: { get_param: oam_network_cidr } dns_nameservers: [ "8.8.8.8" ] router: type: OS::Neutron::Router properties: external_gateway_info: network: { get_param: public_net_id } router_interface: type: OS::Neutron::RouterInterface properties: router_id: { get_resource: router } subnet_id: { get_resource: oam_subnet } rancher_private_port: type: OS::Neutron::Port properties: network: { get_resource: oam_network } fixed_ips: [{"subnet": { get_resource: oam_subnet }}] security_groups: - { get_resource: onap_sg } rancher_floating_ip: type: OS::Neutron::FloatingIP properties: floating_network_id: { get_param: public_net_id } port_id: { get_resource: rancher_private_port }