@@ -9,12 +9,18 @@ def __init__(self, nsxt_profile_attributes):
9
9
"""
10
10
self .ap_http_supported_attributes = nsxt_profile_attributes ['Application_Http_Profile_supported_attr' ]
11
11
self .common_na_attr = nsxt_profile_attributes ['Common_Na_List' ]
12
+ self .np_supported_attributes = nsxt_profile_attributes ['Network_Profile_supported_attr' ]
13
+
14
+
12
15
13
16
14
17
def convert (self , alb_config , nsx_lb_config , prefix ):
15
18
alb_config ['ApplicationProfile' ] = list ()
16
19
alb_config ['NetworkProfile' ] = list ()
17
-
20
+ skipped_ap = []
21
+ skipped_np = []
22
+ attr_ap = []
23
+ attr_np = []
18
24
for lb_pr in nsx_lb_config ['LbAppProfiles' ]:
19
25
name = lb_pr .get ('display_name' )
20
26
if prefix :
@@ -38,21 +44,53 @@ def convert(self, alb_config, nsx_lb_config, prefix):
38
44
u_ignore = []
39
45
ignore_for_defaults = {}
40
46
47
+
41
48
if lb_pr ['resource_type' ] == 'LBHttpProfile' :
42
49
skipped = [val for val in lb_pr .keys ()
43
50
if val not in self .ap_http_supported_attributes ]
44
51
if lb_pr .get ("description" ):
45
52
alb_pr ["description" ] = lb_pr ['description' ]
46
53
47
54
alb_config ['ApplicationProfile' ].append (alb_pr )
55
+ skipped_ap .append (skipped )
56
+
57
+ val = dict (
58
+ name = alb_pr ['name' ],
59
+ resource_type = lb_pr ['resource_type' ],
60
+ alb_pr = alb_pr )
61
+ attr_ap .append (val )
48
62
49
- conv_status = conv_utils .get_conv_status (
50
- skipped , indirect , ignore_for_defaults , nsx_lb_config ['LbAppProfiles' ],
51
- u_ignore , na_list )
52
- conv_utils .add_conv_status ('ApplicationHttpProfile' , lb_pr ['resource_type' ], alb_pr ['name' ], conv_status ,
53
- [{'application_http_profile' : alb_pr }])
54
63
else :
64
+ skipped = [val for val in lb_pr .keys ()
65
+ if val not in self .np_supported_attributes ]
66
+
55
67
alb_config ['NetworkProfile' ].append (alb_pr )
68
+ skipped_np .append (skipped )
69
+ val = dict (
70
+ name = alb_pr ['name' ],
71
+ resource_type = lb_pr ['resource_type' ],
72
+ alb_pr = alb_pr )
73
+ attr_np .append (val )
74
+
75
+ if len (skipped_ap ):
76
+ c = 0
77
+ for skipped in skipped_ap :
78
+ conv_status = conv_utils .get_conv_status (
79
+ skipped , indirect , ignore_for_defaults , nsx_lb_config ['LbAppProfiles' ],
80
+ u_ignore , na_list )
81
+ conv_utils .add_conv_status ('ApplicationHttpProfile' ,attr_ap [c ]['resource_type' ] , attr_ap [c ]['name' ], conv_status ,
82
+ [{'application_http_profile' : attr_ap [c ]['alb_pr' ]}])
83
+ c = c + 1
84
+
85
+ if len (skipped_np ):
86
+ c = 0
87
+ for skipped in skipped_np :
88
+ conv_status = conv_utils .get_conv_status (
89
+ skipped , indirect , ignore_for_defaults , nsx_lb_config ['LbAppProfiles' ],
90
+ u_ignore , na_list )
91
+ conv_utils .add_conv_status ('NetworkProfile' , attr_np [c ]['resource_type' ],attr_np [c ]['name' ], conv_status ,
92
+ [{'network_profile' : attr_np [c ]['alb_pr' ]}])
93
+ c = c + 1
56
94
57
95
58
96
def convert_http (self ,alb_pr ,lb_pr ):
0 commit comments