Commit b1eb1bc5 authored by Maria Arsuaga Rios's avatar Maria Arsuaga Rios
Browse files

FTS-977: Update fts-rest config for links

parent 997ebcb3
Pipeline #156673 passed with stage
in 6 minutes and 1 second
......@@ -56,17 +56,19 @@ class LinkConfigController(BaseController):
source = input_dict.get('source', '*')
destination = input_dict.get('destination', '*')
symbolicname = input_dict.get('symbolicname', None)
if not symbolicname:
raise HTTPBadRequest('Missing symbolicname')
if source == '*' and destination == '*':
raise HTTPBadRequest('Can not use wildcard for both source and destination')
link_cfg = Session.query(LinkConfig).filter(LinkConfig.symbolicname == symbolicname).first()
if not link_cfg:
link_cfg = LinkConfig(
source=source,
destination=destination,
symbolicname=symbolicname
symbolicname=symbolicname,
)
for key, value in input_dict.iteritems():
......
......@@ -58,10 +58,11 @@ function refreshLinks()
.append($("<td></td>").text(link.symbolicname))
.append($("<td></td>").text(link.source))
.append($("<td></td>").text(link.destination))
.append($("<td></td>").text(link.auto_tuning))
.append($("<td></td>").text(link.nostreams))
.append($("<td></td>").text(link.min_active))
.append($("<td></td>").text(link.max_active))
.append($("<td></td>").text(link.optimizer))
.append($("<td></td>").text(link.tcp_buffer_size))
.append($("<td></td>").text(link.urlcopy_tx_to));
tbody.append(tr);
});
......@@ -177,10 +178,11 @@ function setupLinks()
symbolicname: addFrm.find("[name=symbolicname]").val(),
source: addFrm.find("[name=source]").val(),
destination: addFrm.find("[name=destination]").val(),
state: addFrm.find("[name=state]").val(),
nostreams: addFrm.find("[name=nostreams]").val(),
min_active: addFrm.find("[name=min_active]").val(),
max_active: addFrm.find("[name=max_active]").val(),
optimizer_mode: addFrm.find("[name=optimizer_mode]").val(),
tcp_buffer_size: addFrm.find("[name=tcp_buffer_size]").val(),
urlcopy_tx_to: addFrm.find("[name=urlcopy_tx_to]").val(),
};
console.log(payload);
......
......@@ -46,21 +46,27 @@
<input class="form-control" type="text" placeholder="Destination" name="destination"
id="link-add-field-destination"/>
</td>
<td>
<input type="checkbox" checked="checked" name="state"/>
</td>
<td>
<input class="form-control" type="number" placeholder="Streams" name="nostreams"
min="0" max="100"/>
</td>
<td>
<input class="form-control" type="number" placeholder="TCP buffer size" name="tcp_buffer_size"
min="0" max="999999"/>
<input class="form-control" type="number" placeholder="Min Actives" name="min_active"
min="2" max="999999"/>
</td>
<td>
<input class="form-control" type="number" placeholder="Timeout" name="urlcopy_tx_to"
<input class="form-control" type="number" placeholder="Max Actives" name="max_active"
min="2" max="999999" />
</td>
<td>
<input class="form-control" type="number" placeholder="Optimizer Mode" name="optimizer_mode"
min="0" max="5"/>
</td>
<td>
<input class="form-control" type="number" placeholder="TCP buffer size" name="tcp_buffer_size"
min="0" max="999999"/>
</td>
</tr>
</tbody>
</table>
......
......@@ -38,8 +38,6 @@ class TestConfigGlobal(TestController):
global_timeout=55,
sec_per_mb=1,
show_user_dn=True,
max_per_se=10,
max_per_link=15,
vo_name='dteam'
),
status=200
......@@ -47,8 +45,6 @@ class TestConfigGlobal(TestController):
config = Session.query(ServerConfig).get('dteam')
self.assertEqual(42, config.retry)
self.assertEqual(15, config.max_per_link)
audit = Session.query(ConfigAudit).all()
self.assertEqual(1, len(audit))
......@@ -60,7 +56,6 @@ class TestConfigGlobal(TestController):
self.app.post_json(url="/config/global",
params = dict(
retry=55,
max_per_link=5,
vo_name='dteam'
),
status=200
......@@ -68,7 +63,6 @@ class TestConfigGlobal(TestController):
config = Session.query(ServerConfig).get('dteam')
self.assertEqual(55, config.retry)
self.assertEqual(5, config.max_per_link)
audit = Session.query(ConfigAudit).all()
self.assertEqual(2, len(audit))
......
......@@ -36,11 +36,12 @@ class TestConfigLinks(TestController):
'symbolicname': 'test-link',
'source': 'test.cern.ch',
'destination': 'test2.cern.ch',
'state': True,
'nostreams': 16,
'tcp_buffer_size': 4096,
'urlcopy_tx_to': 10,
'auto_tuning': False
'min_active': 25,
'max_active': 150,
'optimizer_mode': 5
}, status=200).json
audits = Session.query(ConfigAudit).all()
......@@ -49,11 +50,11 @@ class TestConfigLinks(TestController):
link = Session.query(LinkConfig).get(('test.cern.ch', 'test2.cern.ch'))
self.assertEqual('test.cern.ch', link.source)
self.assertEqual('test2.cern.ch', link.destination)
self.assertEqual(True, link.state)
self.assertEqual(16, link.nostreams)
self.assertEqual(4096, link.tcp_buffer_size)
self.assertEqual(10, link.urlcopy_tx_to)
self.assertEqual(False, link.auto_tuning)
self.assertEqual(25, link.min_active)
self.assertEqual(150, link.max_active)
self.assertEqual(5, link.optimizer_mode)
self.assertEqual(link.symbolicname, resp['symbolicname'])
self.assertEqual(link.source, resp['source'])
......@@ -67,22 +68,23 @@ class TestConfigLinks(TestController):
'symbolicname': None,
'source': 'test.cern.ch',
'destination': 'test2.cern.ch',
'state': True,
'nostreams': 16,
'tcp_buffer_size': 4096,
'urlcopy_tx_to': 10,
'auto_tuning': False
'min_active': 25,
'max_active': 150,
'optimizer_mode': 5
}, status=400)
self.app.post_json("/config/links", params={
'symbolicname': 'test-link',
'source': '*',
'destination': '*',
'state': True,
'nostreams': 16,
'tcp_buffer_size': 4096,
'urlcopy_tx_to': 10,
'auto_tuning': False
'min_active': 25,
'max_active': 150,
'optimizer_mode': 5
}, status=400)
def test_reconfig_link_se(self):
......@@ -94,11 +96,12 @@ class TestConfigLinks(TestController):
'symbolicname': 'test-link',
'source': 'test.cern.ch',
'destination': 'test2.cern.ch',
'state': True,
'nostreams': 4,
'tcp_buffer_size': 1024,
'urlcopy_tx_to': 5,
'auto_tuning': True
'min_active': 25,
'max_active': 150,
'optimizer_mode': 5
}, status=200).json
audits = Session.query(ConfigAudit).all()
......@@ -107,11 +110,11 @@ class TestConfigLinks(TestController):
link = Session.query(LinkConfig).get(('test.cern.ch', 'test2.cern.ch'))
self.assertEqual('test.cern.ch', link.source)
self.assertEqual('test2.cern.ch', link.destination)
self.assertEqual(True, link.state)
self.assertEqual(4, link.nostreams)
self.assertEqual(1024, link.tcp_buffer_size)
self.assertEqual(5, link.urlcopy_tx_to)
self.assertEqual(True, link.auto_tuning)
self.assertEqual(25, link.min_active)
self.assertEqual(150, link.max_active)
self.assertEqual(5, link.optimizer_mode)
self.assertEqual(link.symbolicname, resp['symbolicname'])
self.assertEqual(link.source, resp['source'])
......@@ -135,11 +138,11 @@ class TestConfigLinks(TestController):
link = self.app.get_json("/config/links/test-link").json
self.assertEqual('test.cern.ch', link['source'])
self.assertEqual('test2.cern.ch', link['destination'])
self.assertEqual(True, link['state'])
self.assertEqual(16, link['nostreams'])
self.assertEqual(4096, link['tcp_buffer_size'])
self.assertEqual(10, link['urlcopy_tx_to'])
self.assertEqual(False, link['auto_tuning'])
self.assertEqual(25, link['min_active'])
self.assertEqual(150, link['max_active'])
self.assertEqual(5, link['optimizer_mode'])
def test_delete_link(self):
"""
......
......@@ -45,14 +45,11 @@ class TestConfigSe(TestController):
'staging': 11
}
},
'as_source': {
'se_info': {
'ipv6': True,
'active': 55
},
'as_destination': {
'ipv6': False,
'active': 1,
'throughput': 33
'outbound_min_active': 55,
'inbound_min_active': 1,
'inbound_min_throughput': 33
}
}
}
......@@ -69,16 +66,11 @@ class TestConfigSe(TestController):
for op in ops:
self.assertEqual(config[op.host]['operations'][op.vo_name][op.operation], op.concurrent_ops)
as_source = Session.query(Optimize).filter(Optimize.source_se == 'test.cern.ch').first()
self.assertIsNotNone(as_source)
self.assertEqual(True, as_source.ipv6)
self.assertEqual(55, as_source.active)
as_dst = Session.query(Optimize).filter(Optimize.dest_se == 'test.cern.ch').first()
self.assertIsNotNone(as_dst)
self.assertEqual(False, as_dst.ipv6)
self.assertEqual(1, as_dst.active)
self.assertEqual(33, as_dst.throughput)
se = Session.query(Se).filter(Se.storage == 'test.cern.ch').first()
self.assertEqual(True, se.ipv6)
self.assertEqual(55, se.outbound_min_active)
self.assertEqual(1, se.inbound_min_active)
self.assertEqual(33, se.inbound_min_throughput)
def test_reset_se_config(self):
"""
......@@ -98,14 +90,11 @@ class TestConfigSe(TestController):
'staging': 4
}
},
'as_source': {
'se_info': {
'ipv6': False,
'active': 88
},
'as_destination': {
'ipv6': True,
'active': 11,
'throughput': 10
'outbound_min_active': 88,
'inbound_min_active': 11,
'inbound_min_throughput': 10
}
}
}
......@@ -122,16 +111,11 @@ class TestConfigSe(TestController):
for op in ops:
self.assertEqual(config[op.host]['operations'][op.vo_name][op.operation], op.concurrent_ops)
as_source = Session.query(Optimize).filter(Optimize.source_se == 'test.cern.ch').first()
self.assertIsNotNone(as_source)
self.assertEqual(False, as_source.ipv6)
self.assertEqual(88, as_source.active)
as_dst = Session.query(Optimize).filter(Optimize.dest_se == 'test.cern.ch').first()
self.assertIsNotNone(as_dst)
self.assertEqual(True, as_dst.ipv6)
self.assertEqual(11, as_dst.active)
self.assertEqual(10, as_dst.throughput)
se = Session.query(Se).filter(Se.storage == 'test.cern.ch').first()
self.assertEqual(False, se.ipv6)
self.assertEqual(88, se.outbound_min_active)
self.assertEqual(11, se.inbound_min_active)
self.assertEqual(10, se.inbound_min_throughput)
def test_get_se_config(self):
"""
......@@ -145,19 +129,17 @@ class TestConfigSe(TestController):
se_cfg = cfg['test.cern.ch']
self.assertIn('operations', se_cfg.keys())
self.assertIn('as_source', se_cfg.keys())
self.assertIn('as_destination', se_cfg.keys())
self.assertIn('se_info', se_cfg.keys())
self.assertEqual(
{'atlas': {'delete': 22, 'staging': 32}, 'dteam': {'delete': 10, 'staging': 11}},
se_cfg['operations']
)
self.assertEqual(True, se_cfg['as_source']['ipv6'])
self.assertEqual(55, se_cfg['as_source']['active'])
self.assertEqual(False, se_cfg['as_destination']['ipv6'])
self.assertEqual(1, se_cfg['as_destination']['active'])
self.assertEqual(33, se_cfg['as_destination']['throughput'])
self.assertEqual(True, se_cfg['se_info']['ipv6'])
self.assertEqual(55, se_cfg['se_info']['outbound_min_active'])
self.assertEqual(1, se_cfg['se_info']['inbound_min_active'])
self.assertEqual(33, se_cfg['se_info']['inbound_min_throughput'])
def test_set_malformed(self):
"""
......@@ -176,14 +158,11 @@ class TestConfigSe(TestController):
'delete': 'must be a number!',
}
},
'as_source': {
'se_info': {
'ipv6': False,
'active': 88
},
'as_destination': {
'ipv6': True,
'active': 11,
'throughput': 10
'outbound_min_active': 88,
'inbound_min_active': 11,
'inbound_min_throughput': 10
}
}
},
......@@ -197,14 +176,11 @@ class TestConfigSe(TestController):
'delete': 2,
}
},
'as_source': {
'se_info': {
'ipv6': False,
'active': 'not again!'
},
'as_destination': {
'ipv6': True,
'active': 11,
'throughput': 10
'active': 'not again!',
'inbound_min_active': 11,
'inbound_min_throughput': 10
}
}
},
......@@ -213,10 +189,10 @@ class TestConfigSe(TestController):
self.app.post_json("/config/se",
params={
'test.cern.ch': {
'as_destination': {
'se_info': {
'ipv6': True,
'active': 0.5,
'throughput': 10
'inbound_min_active': 0.5,
'inbound_min_throughput': 10
}
}
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment